CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Building OpenFOAM 2.0.1 on old Linux OSes - test case Ubuntu 8.04

Register Blogs Members List Search Today's Posts Mark Forums Read

Rating: 2 votes, 5.00 average.

Building OpenFOAM 2.0.1 on old Linux OSes - test case Ubuntu 8.04

Posted October 17, 2011 at 18:49 by wyldckat
Updated February 8, 2012 at 17:41 by wyldckat

This blog post will try to detail and complement the OpenFOAM 2.0.1 building process on old machines, where my test case was with two Ubuntu 8.04 - one i686 and one x86_64 - in two separate virtual machines with 1.6GiB of RAM and 4 processors each.

This post will detail a lot more information than the official instructions, specially because the official instructions are meant for Linux OSes that are modern'ish, such as Ubuntu 10.04 and above.

NOTE: 2011-02-08 - finally managed to figure out what was wrong... and to boot, the the issue was already fixed back in September 2011: https://github.com/OpenFOAM/ThirdPar...c22adcab144d5e - this fixes the issue that existed with x86_64 machines!

  1. Install all of the necessary system packages:
    • Ubuntu 8.04:
      Code:
      sudo apt-get install binutils-dev flex bison git-core build-essential python-dev libreadline5-dev wget zlib1g-dev libpng12-dev libxt-dev libxi-dev libxrender-dev libxrandr-dev libxcursor-dev libxinerama-dev libfreetype6-dev libfontconfig1-dev libglib2.0-dev freeglut3-dev texinfo
      If using Ubuntu 8.04 x86_64, also install:
      Code:
      sudo apt-get install gcc-multilib
    • For any other Linux systems, you'll need:
      • gcc and g++.
      • binutils and necessary headers and library interfaces.
      • flex - if < 2.5.35, one will be talked about later on.
      • Python and respective headers/library interfaces;
      • readline library and headers.
      • wget.
      • libz or zlib.
      • libpng.
      • Some X libraries that Qt and ParaView will demand later on.
      • makeinfo.
      • GLib headers and library interfaces.
      • OpenGL tools, headers and library interfaces - usually provided with your graphics card drivers, but also additional tools seem to be available for OpenGL.
  2. Create the base "OpenFOAM" folder in your own home folder:
    Code:
    cd $HOME
    mkdir OpenFOAM
    cd OpenFOAM
  3. Download OpenFOAM 2.0.1 files, available here: http://openfoam.com/download/source.php
    Code:
    wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.0.1.gtgz?use_mirror=mesh" -O OpenFOAM-2.0.1.gtgz
    wget "http://downloads.sourceforge.net/foam/ThirdParty-2.0.1.gtgz?use_mirror=mesh" -O ThirdParty-2.0.1.gtgz
  4. Unpack files:
    Code:
    tar -xzf OpenFOAM-2.0.1.gtgz
    tar -xzf ThirdParty-2.0.1.gtgz
  5. Add a new alias to your home ".bashrc" file and refresh your shell environment (start a new terminal window/tab if necessary):
    • If your Linux installation is "i?86":
      Code:
      echo alias of201=\'source $HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc foamCompiler=ThirdParty WM_COMPILER=Gcc45 WM_NCOMPPROCS=4 WM_ARCH_OPTION=32\' >> $HOME/.bashrc
      source $HOME/.bashrc
      The 4 is the number of processor cores/threads your machine has.
    • If your Linux installation is "x86_64":
      Code:
      echo alias of201=\'source  $HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc foamCompiler=ThirdParty  WM_COMPILER=Gcc45 WM_NCOMPPROCS=4\' >> $HOME/.bashrc
      source $HOME/.bashrc
      The 4 is the number of processor cores/threads your machine has.
    • If you don't know what installation you have, run:
      Code:
      uname -m
  6. Start your new alias command by running:
    Code:
    of201
    It should show you something like this:
    Code:
    Warning in /home/user/OpenFOAM/OpenFOAM-2.0.1/etc/config/settings.sh:
        Cannot find /home/user/OpenFOAM/ThirdParty-2.0.1/platforms/linux64/gcc-4.5.2 installation.
        Please install this compiler version or if you wish to use the system compiler,
        change the 'foamCompiler' setting to 'system'
  7. Now let us go to the ThirdParty folder and get a couple of important scripts:
    Code:
    foam3rdParty
    wget "http://www.openfoam.com/mantisbt/file_download.php?file_id=102&type=bug" -O getGcc
    wget "http://www.openfoam.com/mantisbt/file_download.php?file_id=142&type=bug" -O getQt
    wget "http://www.openfoam.com/mantisbt/file_download.php?file_id=143&type=bug" -O getCmake
    wget "https://raw.github.com/wyldckat/ThirdParty-2.0.x/binutils/makeBinutils"
    wget "https://raw.github.com/wyldckat/ThirdParty-2.0.x/binutils/getBinutils"
    wget "https://raw.github.com/wyldckat/ThirdParty-2.0.x/binutils/makeMake"
    wget "https://raw.github.com/wyldckat/ThirdParty-2.0.x/binutils/getMake"
    wget "https://raw.github.com/wyldckat/ThirdParty-2.0.x/binutils/makeFlex"
    wget "https://raw.github.com/wyldckat/ThirdParty-2.0.x/binutils/getFlex"
    rm makeCmake
    wget "https://raw.github.com/OpenFOAM/ThirdParty-2.0.x/master/makeCmake"
    chmod +x get* make*
  8. Lets get Gcc and respective dependencies:
    Code:
    ./getGcc gcc-4.5.2
  9. Now lets build Gcc:
    Code:
    ./makeGcc gcc-4.5.2 > mkgcc.log 2>&1
    This will take a while...
  10. Now lets get and build Make:
    Code:
    ./getMake
    ./makeMake gcc-4.5.2 > mkmake.log 2>&1
  11. Refresh the shell environment:
    Code:
    of201
    If it still gives you the same error message from #6, then something went wrong
  12. Now lets get and build Binutils:
    Code:
    ./getBinutils
    ./makeBinutils gcc-4.5.2 > mkbinutils.log 2>&1
  13. Now Qt:
    Code:
    sed -i -e 's=4\.7\.3=4.6.4=' getQt
    ./getQt
    ./makeQt 4.6.4 > mkqt.log 2>&1
  14. Refresh the shell environment:
    Code:
    of201
  15. Now CMake:
    Code:
    ./getCmake
    ./makeCmake > mkcmake.log 2>&1
  16. Refresh the shell environment once again:
    Code:
    of201
  17. Now ParaView:
    Code:
    ./makeParaView -qmake  ${WM_THIRD_PARTY_DIR}/platforms/$WM_ARCH$WM_COMPILER/qt-4.6.4/bin/qmake > mkPV.log 2>&1
  18. Now some minor hacking:
    Code:
    echo 'export LD_LIBRARY_PATH=${WM_THIRD_PARTY_DIR}/platforms/$WM_ARCH$WM_COMPILER/qt-4.6.4/lib:$LD_LIBRARY_PATH' >> $WM_PROJECT_DIR/etc/bashrc
    echo 'export PATH=${WM_THIRD_PARTY_DIR}/platforms/$WM_ARCH$WM_COMPILER/qt-4.6.4/bin:$PATH'  >> $WM_PROJECT_DIR/etc/bashrc
  19. Refresh the shell environment:
    Code:
    of201
  20. Just in case, lets get and build the latest flex as well:
    Code:
    ./getFlex
    ./makeFlex gcc-4.5.2 > mkflex.log 2>&1
  21. Refresh the shell environment:
    Code:
    of201
  22. And now, lets go to the final stage - build OpenFOAM:
    Code:
    foam
    ./Allwmake > mkof.log 2>&1
    It can take about 30min to 8h00, depending on the machine you are using.
  23. When it's done, try checking if the bare minimum is working:
    Code:
    icoFoam -help
  24. If it's OK, start reading here: http://www.openfoam.com/docs/user/

If there are any problems during each stage, the files "mk*.log" and "make.log" will have the necessary details for figuring out what went wrong.

Good luck!
___________________________________
Related notes:
« Prev     Main     Next »
Total Comments 3

Comments

  1. Old Comment
    thanks a lot bruno
    permalink
    Posted October 23, 2011 at 14:10 by ilene2011 ilene2011 is offline
  2. Old Comment
    Hi Bruno,

    I have followed above steps to build OpenFOAm 2.0.1 on SLES 10 SP1 x86_64.

    Everything went well till step 14. There was an error in buliding cmake-2.8.3 (How can I attch the mkcmake.log file??). However, I went ahead and followed next steps till end. Now all solvers are running well.

    But when I try to compile my own solver,

    code: wmake plusPostRANS.C

    following error message comes.

    make: Nothing to be done for `plusPostRANS.C'.

    Can you help me in this?

    Thanks
    Hrushikesh
    permalink
    Posted February 8, 2012 at 04:19 by Hrushi Hrushi is offline
  3. Old Comment
    Hi Hrushikesh,

    Quote:
    Originally Posted by Hrushi View Comment
    I have followed above steps to build OpenFOAm 2.0.1 on SLES 10 SP1 x86_64.

    Everything went well till step 14. There was an error in buliding cmake-2.8.3 (How can I attch the mkcmake.log file??).
    Create a new thread here: http://www.cfd-online.com/Forums/openfoam-installation/ - and attach your log file.

    Quote:
    Originally Posted by Hrushi View Comment
    But when I try to compile my own solver,

    code: wmake plusPostRANS.C

    following error message comes.

    make: Nothing to be done for `plusPostRANS.C'.
    Simply run:
    Code:
    wmake
    That file is mentioned inside the file "Make/files".

    My go-to tutorial for learning more about changing and compiling solvers is this one: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

    edit: thread and respective solution: Building OpenFOAM 2.0.1 on SLES 10 SP1 x86_64

    Best regards,
    Bruno
    permalink
    Posted February 8, 2012 at 04:51 by wyldckat wyldckat is offline
    Updated February 8, 2012 at 17:45 by wyldckat (see "edit:")
 

All times are GMT -4. The time now is 05:57.