Compiling OpenFOAM 1.7.0 on Fedora 13

On June 26, 2010, OpenFOAM 1.7.0 has been released. But It does not provide any compiled packages but Ubuntu/Debian binary packages.

I have been using OpenFOAM for years without compiling the whole OpenFOAM and ThirdParty packages. It’s time to do it myself.

Before compiling the packages, you must prepare some necessary packages on your system:

  • binutils-static # it provides libiberty.a and others
  • python-devel # if you want the python support in paraview
  • qt-devel # I suppose you like it. Yes, it provides qmake-qt4
  • cmake # it is mandatory for compiling paraview
  • flex

Please use yum to install them:

sudo yum install -y binutils-static python-devel qt-devel cmake flex

Of course, I believe you have gcc 4.4-x which is recommended by OpenFOAM.

the $HOME/OpenFOAM directory is supposed as your OpenFOAM installation folder. And I guess you have downloaded the source packages files.

1) enter into the OpenFOAM installation folder and unpack the zipped files

tar xvf /path/OpenFOAM-1.7.0.gtgz
tar xvf /path/ThirdParty-1.7.0.gtgz

2) setting the environment variables

adding the line to your $HOME/.bashrc

. $HOME/OpenFOAM/OpenFOAM-1.7.0/etc/bashrc

and type . $HOME/.bashrc to execute the file and make the OpenFOAM variables available.

3) Check the system

execute foamSystemCheck

4) Build the source


5) Compile ParaView 3.8.0 and PV3FoamReader module


compiling PV3blockMeshReader and PV3FoamReader ParaView plugins as usual for OpenFOAM utilities:

cd $FOAM_UTILITIES/postProcessing/graphics/PV3Readers

6) Test Installation


Most of the time, the compilation would have errors like
-lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/xyz/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/potentialFoam
/usr/bin/ld: Make/linux64GccDPOpt/potentialFoam.o: undefined reference to symbol ‘Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)’
/usr/bin/ld: note: ‘Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)’ is defined in DSO /home/xyz/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/openmpi-1.4.1/ so try adding it to the linker command line
/home/sheldon/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/openmpi-1.4.1/ could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [/home/xyz/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/potentialFoam] Error 1
make[2]: Leaving directory `/home/xyz/OpenFOAM/OpenFOAM-1.7.x/applications/solvers/basic/potentialFoam’
make[1]: *** [potentialFoam] Error 2

This error is caused by DSO links. The DSO link library should be stated explicitly in Fedora 13. So the file ./Make/options in the solver directory should be edited with the DSO library.

Make a batch file in your home bin directory, named patchFoamLib, with the content

#! /bin/sh

sed -i '$ s|$|\ \\|' $1
sed -i '$ a\ \ \ \ $(FOAM_MPI_LIBBIN)/'  $1

and make it executable. In the Terminal, use the command

patchFoamLib Make/options

if you want to patch the file of options in one time, use the command

cd $WM_PROJECT_DIR/applications/solvers/
find . -iname 'options' -execdir patchFoamLib {}\;

I hope this would help you compile your own OpenFOAM successfully.

On July 30, Laurence R. McGlashan [2] suggested editing the wmake/rules/linux64Gcc/general file, which is easier than editing the all options files:


This would be a better solution.

Sometimes, if errors happen with like this, there’s a need a manual editing for options file with the missing library. if the error reports the missing link is libincompressibleTurbulenceModels, the following should be added to the EXE_LIBS options (you know I mean this is in file options)


Or other OpenFOAM model libraries.


[1] OpenFOAM. Source pack installation., <2010-06-30>
[2], <2010-07-30>

3 Replies to “Compiling OpenFOAM 1.7.0 on Fedora 13”

  1. Please add the line to the EXE_LIBS option in the file ./Make/options in the solver directory.


    and this option should be

    EXE_LIBS = -lfiniteVolume

    then remake it.

    Some other errors like this should be edit the options file like the above.

    Because the DSO link library should be declared explicitly in Fedora 13.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.