CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   How to compile OpenFOAM-1.7.x on CrunchBang linux 10 (http://www.cfd-online.com/Forums/openfoam-installation/86879-how-compile-openfoam-1-7-x-crunchbang-linux-10-a.html)

gwierink April 5, 2011 04:38

How to compile OpenFOAM-1.7.x on CrunchBang linux 10
 
Dear all,

Just for fun I tried out CrunchBang Linux, a Debian based distribution. It is minimalistic, uses OpenBox and it's just blazing fast. I thought to share my notes on compiling OpenFOAM-1.7.x on CrunchBang 10 (32 bit) with you. These are just my notes on setting up the system, combined with OpenCFD's instructions on installation. I just thought it would be nice to share :).

First off, CrunchBang is Debian based, so OpenCFD's Ubuntu/Debian package may work out of the box, so do give that a try if you like. However, I decided to compile the updated OpenFOAM-1.7.x on my CrunchBang box. Here it goes.

First, make sure you have superuser right (sudo), because we need to install some libraries and programs. There are standard packages, but in many cases it is just nicer to compile the latest stable version yourself. In that way you know exactly what you have and it is optimized for your system. Now, add yourself to the "sudoers" to get superuser rights do:
Code:

sudo visudo
(which will ask for your user login password) and add your login name followed by "ALL=(ALL) ALL", just like the root account in the visudo file. In case you don't know, visudo uses the vi editor. First, type "i" to get into insert mode, add the text, press Esc, and save and exit by typing ":wq".

CrunchBang linux 10 came with gcc 4.4.5 and python 2.6.6, so that's fine. Then, to compile OpenFOAM we need zlib. I got zlib-1.2.5 from here. Create some directory to store the libs and compile zlib there. I create libs in my home directory, as:
Code:

cd
mkdir -p libs/zlib
cd libs/zlib
wget http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib-1.2.5.tar.gz
tar xzf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure
make
sudo make install

Now, to pull the latest OpenFOAM-1.7 code, called OpenFOAM-1.7.x, we need a program called git. It has to be version 1.7 or higher.
To build the latest stable git, we need a library called curl (here I use curl-7.21.4). Get it from here.
Code:

cd ~/libs
mkdir curl
cd curl
wget http://curl.haxx.se/download/curl-7.21.4.tar.gz
tar xzf curl-7.21.4.tar.gz
cd curl-7.21.4
./configure
make
sudo make install

OK, now we can build git:
Code:

cd ~/libs
mkdir git
cd git
wget http://kernel.org/pub/software/scm/git/git-1.7.4.3.tar.bz2
tar xjf git-1.7.4.3.tar.bz2
cd git-1.7.4.3
./configure
make
sudo make install

For building we need the flex library, and for some conversion and postprocessing tools we need a few libx libraries (otherwise tecio complains about missing X11/Intrinsic.h, for example). Also, for some handy tools like swak4Foam, funkySetFields, etc., we need svn and bison. Install these libs and programs by:
Code:

sudo apt-get install flex libxt-dev libxaw7-dev libxext-dev libxrender qt4-qmake qt4-dev-tools subversion-tools bison
Also make sure you have binutils and build-essential installed:
Code:

dpkg --get-selections | grep binutils && dpkg --get-selections | grep build-essential
Now we can get the OpenFOAM source code and get to work! Check out OpenCFD's git section for updated instructions.

Code:

mkdir ~/OpenFOAM && cd ~/OpenFOAM
git clone git://github.com/OpenCFD/OpenFOAM-1.7.x.git
cd OpenFOAM-1.7.x
git pull
cd ~/OpenFOAM
wget http://downloads.sourceforge.net/foam/ThirdParty-1.7.1.gtgz
tar xzf ThirdParty-1.7.1.gtgz
mv ThirdParty-1.7.1 ThirdParty-1.7.x

Source OpenFOAM's bash in your bashrc by adding the line ". $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc" to your ~/.bashrc file:
Code:

echo -e "\n. $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc" >> ~/.bashrc
. ~/.bashrc

Finally, start building OpenFOAM. It is useful for error hunting to keep a record of the building process, so do:
Code:

cd ~/OpenFOAM/OpenFOAM-1.7.x
./Allwmake >make.log 2>make.err &

You can follow the progress by:
Code:

cd ~/OpenFOAM/OpenFOAM-1.7.x
tail -f make.log

Enjoy! :)


All times are GMT -4. The time now is 06:13.