CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   Problems compiling OpenFOAM-1.5 (

botp December 21, 2010 04:50

Problems compiling OpenFOAM-1.5

I am currently trying to compile OpenFOAM-1.5, by including one line at a time in the OpenFOAM-1.5/Allwmake file. There were no compiler errors before I included the line
"(cd src && ./Allwmake)".

The following is copied from the compiler output:


+ wmake libso dynamicMesh
SOURCE=fvMeshDistribute/fvMeshDistribute.C ;  g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3  -DNoRepository -ftemplate-depth-40 -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/src/meshTools/lnInclude -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/src/triSurface/lnInclude -IlnInclude -I. -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/fvMeshDistribute.o
In file included from fvMeshDistribute/fvMeshDistribute.H:398,
                from fvMeshDistribute/fvMeshDistribute.C:27:
fvMeshDistribute/fvMeshDistributeTemplates.C: In static member function `static void Foam::fvMeshDistribute::sendFields(Foam::label, const Foam::wordList&, const Foam::fvMeshSubset&)':
fvMeshDistribute/fvMeshDistributeTemplates.C:294: error: expected primary-expression before '>' token
make: *** [Make/linux64GccDPOpt/fvMeshDistribute.o] Error 1
+ wmake libso dynamicFvMesh
/usr/bin/ld: cannot find -ldynamicMesh
collect2: ld returned 1 exit status
make: *** [/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/] Error 1
+ wmake libso topoChangerFvMesh
/usr/bin/ld: cannot find -ldynamicFvMesh
collect2: ld returned 1 exit status
make: *** [/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/] Error 1
+ wmake libso fvMotionSolver
/usr/bin/ld: cannot find -ldynamicMesh
collect2: ld returned 1 exit status
make: *** [/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/] Error 1
+ wmake libso engine
/usr/bin/ld: cannot find -ldynamicMesh
collect2: ld returned 1 exit status
make: *** [/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/] Error 1
+ wmake libso ODE
'/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/' is up to date.
+ wmake libso randomProcesses
'/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/' is up to date.
+ cd thermophysicalModels
+ ./Allwmake

As seen, do the "Error 1" occur several times. Anyone who has a suggestion how to solve this problem?

Kind regards,
Bo Terp

PS. I know that 1.5 is an old version, but I use a utility developed and tested in OF-1.5, so I would like to stay with that version.

wyldckat December 21, 2010 15:52

Greetings Bo Terp,

If I'm not mistaken, OpenFOAM 1.5 will only build with gcc versions up to 4.3.x (x>=0). So, the error you are getting is probably due to your gcc version being 4.4.x or 4.5.x.

Usually, Linux distros have an older gcc version available in their repositories. For example, Ubuntu 10.10 has gcc 4.4.4 by default, but you can also install gcc 4.3.5 and 4.1.2. For example, I've got these three installed in my Ubuntu installation (altough I don't remember installing all of them...). Oh, you'll need both gcc and g++! These older versions can be called by running gcc-4.3 and gcc-4.1.

As for changing the gcc version to be used by OpenFOAM's wmake, see this post:

If you still have problems compiling OpenFOAM 1.5, it would be easier if we knew the Linux distribution you are using and gcc/g++ version you are using.

Best regards and good luck!

botp December 22, 2010 06:07

Thank you very much for your quick reply!

I think you are right that the errors are due to an incorrect compiler version; but unfortunately I am still doing it wrong...:o

I have tried to use the gcc compiler (4.3.3) from the ThirdParty directory by making the following changes to the bashrc and, but it was unsuccessful... I still get the same compiler errors.

Is it actually possible to link to ThirdParty or do I need to install the compiler locally on the system?

Kind regards,
Bo Terp

Ps. All help is truly appreciated!

System information:
Distribution: CentOS 4.6 (Working on a cluster with no administrator privileges)
gcc: gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9)

Changes in /OpenFOAM-1.5-dev/etc/bashrc:
WM_CC='gcc' ----> WM_CC='gcc43'
WM_CXX='g++'----> WM_CXX='g++43'

Changes in /OpenFOAM-1.5-dev/etc/
compilerInstall=System ---> compilerInstall=OpenFOAM
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH ----> [...]/gcc-4.3.3/[...]

wyldckat December 22, 2010 19:36

Hi Bo Terp,

You could have said it before, that you were trying to build OpenFOAM 1.5-dev! The "-dev" version is very different from the official 1.5 version! The 1.5-dev version has received far more updates than the official 1.5 and 1.5.x versions of OpenFOAM!
The 1.5-dev version is know to even build with gcc 4.5.1!!

Here is a thread about it: - you can start reading from post #8, because that's where I start to explain how I managed to build it with gcc 4.5.1 ;)
Although, I suggest using gcc 4.4.4 or 4.4.5, because I'm not sure if 1.5-dev is fully compatible with gcc 4.5.1. But it should also work quite well with gcc 4.3.3!

Best regards and good luck!

randomid December 23, 2010 21:41

the same as me when compiling openfoam-1.5-dev,
my system compiler version is 4.4.*,and i put a pre-compile gcc 4.3.3 in the ThirdParty directory, but the compile process may be use the system compiler.

SOURCE=writePointSet.C ; g++ -m32 -Dlinux -DDP -DFOAM_DEV_REVISION_NUMBER=1861 -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -DREADLINE=1 -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/meshTools/lnInclude -IlnInclude -I. -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/writePointSet.o
SOURCE=writeFuns.C ; g++ -m32 -Dlinux -DDP -DFOAM_DEV_REVISION_NUMBER=1861 -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -DREADLINE=1 -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/meshTools/lnInclude -IlnInclude -I. -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/writeFuns.o
SOURCE=writePatch.C ; g++ -m32 -Dlinux -DDP -DFOAM_DEV_REVISION_NUMBER=1861 -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -DREADLINE=1 -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/meshTools/lnInclude -IlnInclude -I. -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/writePatch.o
SOURCE=setSet.C ; g++ -m32 -Dlinux -DDP -DFOAM_DEV_REVISION_NUMBER=1861 -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -DREADLINE=1 -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/meshTools/lnInclude -IlnInclude -I. -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/setSet.o
g++ -m32 -Dlinux -DDP -DFOAM_DEV_REVISION_NUMBER=1861 -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -DREADLINE=1 -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/meshTools/lnInclude -IlnInclude -I. -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/root/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude -fPIC -pthread Make/linuxGccDPOpt/writePointSet.o Make/linuxGccDPOpt/writeFuns.o Make/linuxGccDPOpt/writePatch.o Make/linuxGccDPOpt/setSet.o -L/root/OpenFOAM/OpenFOAM-1.5-dev/lib/linuxGccDPOpt \
-lmeshTools -lreadline -lncurses -lOpenFOAM -ldl -lm -o /root/OpenFOAM/OpenFOAM-1.5-dev/applications/bin/linuxGccDPOpt/setSet
/usr/bin/ld: cannot find -lmeshTools
collect2: ld returned 1 exit status
make[3]: *** [/root/OpenFOAM/OpenFOAM-1.5-dev/applications/bin/linuxGccDPOpt/setSet] Error 1
make[2]: *** [setSet] Error 2

botp January 5, 2011 06:51


I am still struggling with compiling OpenFOAM-1.5-dev.
Several of the previous problems with the compiler version etc. have been solved and I have been able to run ./Allwake in the src directory successfully.

But, when running ./Allwmake in the applications directory I get the following error


+ cd applications
+ ./Allwmake
+ cd solvers
+ wmake all
g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/cfdTools    -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude    -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/basic/lnInclude    -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/turbulenceModels/RAS -IlnInclude -I. -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC Make/linux64GccDPOpt/rhoSimpleFoam.o -L/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/lib/linux64GccDPOpt \
    -lfiniteVolume    -lmeshTools    -lbasicThermophysicalModels    -lspecie    -lcompressibleRASModels    -llduSolvers -lOpenFOAM -liberty -ldl  -lm -o /home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/applications/bin/linux64GccDPOpt/rhoSimpleFoam
g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude    -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/randomProcesses/lnInclude    -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude -IlnInclude -I. -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC Make/linux64GccDPOpt/dnsFoam.o -L/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/lib/linux64GccDPOpt \
    -lfiniteVolume    -lrandomProcesses    -lsampling    -lmeshTools -lOpenFOAM -liberty -ldl  -lm -o /home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/applications/bin/linux64GccDPOpt/dnsFoam
/usr/bin/ld: cannot find -lOpenFOAM
collect2: ld returned 1 exit status

make[2]: *** [/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/applications/bin/linux64GccDPOpt/rhoSimpleFoam] Error 1
make[1]: *** [rhoSimpleFoam] Error 2
/usr/bin/ld: cannot find -lOpenFOAM
collect2: ld returned 1 exit status
make[2]: *** [/home/afm/afmbtp/OpenFOAM/OpenFOAM-1.5-dev/applications/bin/linux64GccDPOpt/dnsFoam] Error 1
make[1]: *** [dnsFoam] Error 2
make[1]: Target `application' not remade because of errors.
make: *** [DNS] Error 2


When looking around the forum I can see that /usr/bin/ld: cannot find -l<something> is a common error, but I haven't been able to find an explanation for the /usr/bin/ld: cannot find -lOpenFOAM.

Anyone who has a suggestion what causes this error?

I am using ThirdParty from OF-1.6, and the gcc-rules (./wmake/rules/linux64Gcc) from OF-1.7.0. I.e. gcc.4.3.3, gmp-4.2.4 and mpfr-2.4.1. Besides that I have exported WM_64=on as suggested here

Kind regards,
Bo Terp

wyldckat January 5, 2011 09:30

Greetings to all!

I should have posted this on my first post here on this thread, but I guess it's better late than ever :)

OK, got to the base project folder for OpenFOAM 1.5-dev and run Allwmake like this:

./Allwmake > make.log 2>&1
tar -czf make.log.tar.gz make.log

This will keep a log of the build process and the last line will compress the log into a gzip tarball. Then please attach the compressed log file to your next post. This way we can be certain of what is going on, otherwise we'll just be trying to guess what is wrong.

edit: @Bo Terp, that blog post seems to be referring to OpenFOAM 1.3, so the "WM_64=on" is no longer needed for newer OpenFOAM versions. But that reference to installing binutils-dev is still valid for modern versions OpenFOAM!

Best regards,

botp January 5, 2011 11:17

1 Attachment(s)
Hi Bruno and thank you for your quick reply,

I have attached the log file as suggested in your previous post; hopefully this file will reveal the source of all the compiler errors...

Regarding the binutils-dev I am not sure if this is installed or not. I have tried to download the source code and compile it, but I have my doubts whether it succeeded... And since I am not sure whether this is the source of my errors, I didn't spend to much time on it.

Your help is appreciated!

Kind regards,
Bo Terp

wyldckat January 5, 2011 11:35

Hi Bo Terp,

Ah HA, finally I've figured out what's wrong :)


+ wmake libso OpenFOAM
linux64GccDPOpt/options:14: *** missing separator.  Stop.
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created

I've already come across these issues in the past, as you can see here:
The relevant detail in particular is this:

Originally Posted by wyldckat (Post 280401)
remove those pesky "//" lines from the files files and options that some libraries have... namely:


Good luck!

botp January 6, 2011 08:34

Now, everything is compiling and working perfectly... Thank you very much for your help!

Kind regards,
Bo Terp

All times are GMT -4. The time now is 03:19.