CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   install OpenFoam 1.6 by building source: how? (

niudie September 2, 2009 22:45

install OpenFoam 1.6 by building source: how?
Dear Foamers,

I am experiencing problems while building OF 1.6 from source. I tried several times and failed. I followed the README but still found something is not so clear in it. The following are what I trying to do, what I understood about the README and what confused me:

I want to install OF 1.6 by completely building from the source, both OF 1.6 and the third party stuff.

I downloaded OpenFOAM-1.6.General.gtgz ThirdParty-1.6.General.gtgz and extracted the packages following the README without problems. My system is i386/i686 with SLED 10 SP2, gcc 4.1.2. The gcc is too old according to the doc. I need a gcc 4.3.3. We have a gcc-4.3.3 source in the ThirdParty dir. The following is the Allwmake script in the top-level install dir:
cd ${0%/*} || exit 1 # run from this directory
set -x

# wmake is required for subsequent targets
( cd wmake/src && make )

# build ThirdParty sources
( cd $WM_THIRD_PARTY_DIR && ./Allwmake )


if [ "$1" = doc ]

# ----------------------------------------------------------------- end-of-file

It seems it will build all the third party source before building openfoam. If so, gcc-4.33 would be built before building openfoam. Would that mean I could use my system native gcc-4.1.2 to build third party stuff (including gcc-4.3.3)? Or I must install a gcc-4.3.3 binary first in the designated dir: $WM_PROJECT_INST_DIR/ThirdParty/gcc-<GCC_VERSION>/platforms/$WM_ARCH$WM_COMPILER_ARCH/ ? The gcc-4.3.3 binary would build everything, even including the gcc-4.3.3 in the third party source?

Thanks in advance.


gwierink September 3, 2009 02:09

Hi Niudi,

What are the error messages you get? I also had these problem and I just went line by line through the make scripts and found some libraries missing (in my case the binutils and zlib development packages). I installed them and it worked.

Best regards,


niudie September 3, 2009 03:16

mainly lib linking problems
Hi Gijs,

Thanks for your reply.

Very often the error message as follows:
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make[2]: *** [/home/guo/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/sonicLiquidFoam] Error 1
make[1]: *** [sonicLiquidFoam] Error 2
make[1]: Target `application' not remade because of errors.
make: *** [compressible] Error 2
Making dependency list for source file dsmcFoam.C
/usr/bin/ld: cannot find -lmeshTools
collect2: ld returned 1 exit status
make[3]: *** [/home/guo/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/dsmcFoam] Error 1
make[2]: *** [dsmcFoam] Error 2
make[2]: Target `application' not remade because of errors.
make[1]: *** [dsmc] Error 2
Making dependency list for source file mdEquilibrationFoam.C
/usr/bin/ld: cannot find -lmeshTools
collect2: ld returned 1 exit status
make[3]: *** [/home/guo/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/mdEquilibrationFoam] Error 1
make[2]: *** [mdEquilibrationFoam] Error 2
and many lines like above. I used gcc-4.3.3 from the third-party binary pack. Seems that the LD_LIBRARY_PATH with something wrong, or the libs never built. I am currently going through line by line the make tree. :) I would appreciate your advices or tricks.

Best regards,


gwierink September 3, 2009 07:59

Hi Niudie,

I had the same trouble. In the OpenFOAM Wiki it says that these errors of "cannot find -lsomething" goes away after a second compilation run. That didn't work for me and I went step by step through the Allwmake file in src. Along the way I found that I missed flex, installed it and compiled step by step.

Best regards,


MadsR September 3, 2009 09:44

I made a short-hand guide, which you actually can run as a script (I take no responsibility for a complete screw-up, though) here:

I just checked it under a new and clean user account in Ubuntu 9.04. Please let me know if it works (if you haven't managed otherwise).

If you do not have an apt-get-Linux, the apt-get line should hint what libs are needed.


niudie September 4, 2009 00:57

Hi Gijs,

The installation by building source is done. The problem resulted from missing the third-party source ( I should have read the README more carefully). building openfoam source needs something from the third party source, otherwise libs like decompositionMethods wouldn't be built and a lot of further building steps would get errors of missing libs. Some important points as below:

1) needs a gcc-4.3.3, I used the one from the third-party binary packaged.
2) the third-party source must be present in a correct path as defined in the bashrc ( in etc/).

Thanks for your discussion and hints.

Best regards,


niudie September 4, 2009 01:02

Hi Mads,

Thanks for your script. I solved my problem before reading your post. I may try your script in another computer with RHLE and share the infos.

Best regards,


MadsR September 5, 2009 14:47

Hi Niudie. Super.

I've just updated the apt-get section of the script with a few more libs that was needed.


bart_weisser February 5, 2010 05:01

wmake & "make distclean"
Hello there:

First time user here! I have been trying to figure out how to get wmake and the make script "distclean" from Debian Lenny (or any distro for all that matter). When I did a makeall on the ThirdParty stuff, it kept complaining either about wmake or having no idea what to do with "make distclean". Perhaps someone could lend a hand? I have been at this for the last three days :(

Thanks a million, Bart.

MadsR February 5, 2010 05:36

May I suggest:

1) install Ubuntu 9.10 from scratch
2) run the OpenFOAM installation script found in my signature, line by line
3) foam away


cheng1988sjtu April 26, 2011 00:10

Hi All,

I'm compiling openfoam1.7.1 on cluster using intel as compiler and openmpi-1.4.3, However , I encountered this error
HTML Code:

+ wmake libso mpi
make: *** No rule to make target `/home/44792/OpenFOAM/ThirdParty-1.7.1/platforms/linux64Gcc/openmpi-1.4.1/include/mpi.h', needed by `Pstream.dep'.  Stop.
icpc: command line remark #10279: option '-xT' is deprecated and will be removed in a future release. See '-help deprecated'
lnInclude/pTraits.H(71): warning #597: "Foam::pTraits<PrimitiveType>::operator Foam::vector() const [with PrimitiveType=Foam::vector]" will not be called for implicit or explicit conversions
          operator PrimitiveType() const
          detected during:
            instantiation of class "Foam::pTraits<PrimitiveType> [with PrimitiveType=Foam::vector]" at line 87 of "lnInclude/Field.H"
            instantiation of class "Foam::Field<Type> [with Type=Foam::vector]" at line 146 of "lnInclude/edgeI.H"

lnInclude/pTraits.H(76): warning #597: "Foam::pTraits<PrimitiveType>::operator Foam::vector &() [with PrimitiveType=Foam::vector]" will not be called for implicit or explicit conversions
          operator PrimitiveType&()
          detected during:
            instantiation of class "Foam::pTraits<PrimitiveType> [with PrimitiveType=Foam::vector]" at line 87 of "lnInclude/Field.H"
            instantiation of class "Foam::Field<Type> [with Type=Foam::vector]" at line 146 of "lnInclude/edgeI.H"

I'm pretty sure in some file that I didn't assign the right path, however, I cann't find which file.

I've changed the $WM_COMPILER=Icc,

and I've changed $MPI_ARCH_PATH=/usr/mpi/intel/openmpi-1.4.3

Also, I've changed the ~/.cshrc, and sourced that.

This could be due to the previous failure when I'm trying to compile using ThirdParty-1.7.1, However, I was told that in cluster, if I want to use parallel computing, I'd better use the system openmpi and compiler, so how can I clean the previous stored path?

Any help will be highly appreciated, I've been stucked here for a while.

cheng1988sjtu April 26, 2011 00:18

BTW, I've tried to compile use default gcc/openmpi, but the pre-installed gcc is just 4.1.2, way too old for openfoam1.7.1, since I don't have the root right, I can only try intel as compiler.
the icc version is 12.0.0;)

gwierink April 26, 2011 00:25

Hi Charlie,

It looks like you're having Pstream trouble. You need to set WM_COMPILER etc, as you did, but also provide some wmake rules so that the compiler can find the mpi libraries on your system. Have a look here how I rigged up wmake rules to make OpenFOAM compile.

cheng1988sjtu April 26, 2011 00:48

Thank you!
:DThank you very much for you reply.

It think that's what I need. I'll try it tomorrow and let you know the result.

All times are GMT -4. The time now is 02:31.