Building OpenFOAM 2.0.1 on old Linux OSes - test case Ubuntu 8.04
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!
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:
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!
- 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
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.
- Ubuntu 8.04:
- Create the base "OpenFOAM" folder in your own home folder:Code:
cd $HOME mkdir OpenFOAM cd OpenFOAM
- 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
- Unpack files:Code:
tar -xzf OpenFOAM-2.0.1.gtgz tar -xzf ThirdParty-2.0.1.gtgz
- 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
- 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
- If you don't know what installation you have, run:Code:
uname -m
- If your Linux installation is "i?86":
- Start your new alias command by running:Code:
of201
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'
- 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*
- Lets get Gcc and respective dependencies:Code:
./getGcc gcc-4.5.2
- Now lets build Gcc:Code:
./makeGcc gcc-4.5.2 > mkgcc.log 2>&1
- Now lets get and build Make:Code:
./getMake ./makeMake gcc-4.5.2 > mkmake.log 2>&1
- Refresh the shell environment:Code:
of201
- Now lets get and build Binutils:Code:
./getBinutils ./makeBinutils gcc-4.5.2 > mkbinutils.log 2>&1
- Now Qt:Code:
sed -i -e 's=4\.7\.3=4.6.4=' getQt ./getQt ./makeQt 4.6.4 > mkqt.log 2>&1
- Refresh the shell environment:Code:
of201
- Now CMake:Code:
./getCmake ./makeCmake > mkcmake.log 2>&1
- Refresh the shell environment once again:Code:
of201
- Now ParaView:Code:
./makeParaView -qmake ${WM_THIRD_PARTY_DIR}/platforms/$WM_ARCH$WM_COMPILER/qt-4.6.4/bin/qmake > mkPV.log 2>&1
- 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
- Refresh the shell environment:Code:
of201
- Just in case, lets get and build the latest flex as well:Code:
./getFlex ./makeFlex gcc-4.5.2 > mkflex.log 2>&1
- Refresh the shell environment:Code:
of201
- And now, lets go to the final stage - build OpenFOAM:Code:
foam ./Allwmake > mkof.log 2>&1
- When it's done, try checking if the bare minimum is working:Code:
icoFoam -help
- 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:
Total Comments 3
Comments
-
thanks a lot bruno
Posted October 23, 2011 at 14:10 by ilene2011 -
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
HrushikeshPosted February 8, 2012 at 04:19 by Hrushi -
Hi Hrushikesh,
Quote:
Quote:Code:wmake
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,
BrunoPosted February 8, 2012 at 04:51 by wyldckat
Updated February 8, 2012 at 17:45 by wyldckat (see "edit:")