CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   Compiler error with OF 2.1.1 on OpenSUSE 12.3 (64bit) [GeekoCFD 5.0] (

derkermit May 14, 2013 11:01

Compiler error with OF 2.1.1 on OpenSUSE 12.3 (64bit) [GeekoCFD 5.0]
1 Attachment(s)
I recently installed GeekoCFD 5.0 which is based on OpenSUSE 12.3 (64bit). Because of some tools which won't work with OF 2.2 which is automatically installed along with GeekoCFD, I need to install OF 2.1.1. Therefore I downloaded and compiled the source code according to this guide:
I tried to attach the make.log to this post but it is too big. As far as I can see, there are only minor problems occuring in the log.

When I try to compile my own library with "wclean"/"wmake libso", I get the following error message:

wmakeLnInclude: linking include files to ./lnInclude                                                                               
Making dependency list for source file fiberPorousZone.C                                                                           
make: *** Keine Regel vorhanden, um das Target »fiberPorousZones.dep«,                                                             
  benötigt von »Make/linux64GccDPOpt/dependencies«, zu erstellen.  Schluss.

At first, I thought this could be due to an error of the gcc installation. "which gcc" gives "/usr/bin/gcc". Then I copied simpleFoam and compiled that again with no error. I also compiled another library without problems. Now I'm confused and I hope that someone has a clue.

Some outputs which might help:

gcc -v

Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.7 --enable-ssp --disable-libssp --disable-libitm --disable-plugin --with-bugurl= --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --program-suffix=-4.7 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.7.2 20130108 [gcc-4_7-branch revision 195012] (SUSE Linux)


echo $PATH

Let me know if something else is of interest!

Thanks in advance, Alex

wyldckat May 14, 2013 16:06

Greetings Alex,

I haven't tried GeekoCFD yet, so I don't know what the default installation looks like.

Remember the step #4 from the instructions you mentioned? Try changing it to this:

"WM_COMPILER=Gcc47" is the new part.
And edit the file "~/.bashrc" accordingly as well.

Then start a new terminal window or tab, just in case. After that, you'll have to do step #5 once again.

Another detail is that you have to be careful to avoid having OpenFOAM versions go into conflict between them. Read this blog post for more information: Advanced tips for working with the OpenFOAM shell environment

Best regards,

derkermit May 15, 2013 04:13

1 Attachment(s)
Hey Bruno,
I changed my bashrc and it's compiling again at the moment. One question regarding this: Is it necessary to be in su mode when compiling OpenFOAM?

I'm switching between the OF versions with aliases as it is proposed in your link. I checked the OF environment variables and they seem to be ok.

Thanks, Alex

EDIT: Compilation finished -> see attachment. I could not find any errors in the log. The error message when compiling the library is the same. I also tried to compile it with "sudo wmake libso" and the output is:


wmake error: environment variable $WM_OPTIONS not set
echo $WM_OPTIONS gives:


So in fact it is set but why do I get that error?

wyldckat May 15, 2013 19:33

Hi Alex,

What a confusion of versions you've got there :(
OK, so here's the situation:
  • It looks like you're installing OpenFOAM 2.1.1 in "/opt". This usually requires root powers, hence the need for "sudo" or "su".
  • Then you're trying to build another library/application, while in normal user mode.
The problem is that in "su" mode, it has a shell environment for the root user. In normal user mode, you have another shell environment. And at least one of them is incorrectly defined.

The instructions at instruct on how to install at "$HOME/OpenFOAM" as normal user, but you're installing at "/opt/OpenFOAM" as root user.

My guess is that you started to follow the instructions while the shell environment was activated for the pre-installed OpenFOAM 2.2.x or 2.2.0; then when you followed the instructions, you ended up somehow installing at "/opt" :(

Anyway, edit the file "/opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc" as root (using "su") and look for these lines:

# foamInstall=~$WM_PROJECT
# foamInstall=/opt/$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT

Changed them to this:

# foamInstall=$HOME/$WM_PROJECT
# foamInstall=~$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT

Then edit your normal user's "~/.bashrc" and adapt the alias for 2.1.1 to point to the path at "/opt". And remove "WM_COMPILER=Gcc47" from your personal "~/.bashrc" file, since as root it was defined as "WM_COMPILER=Gcc".

Start a new terminal and try to see how things are working.

Best regards,

derkermit May 16, 2013 05:48

5 Attachment(s)
Hey Bruno,
sorry, I forgot to tell you that I want to install in opt/. I thought that would keep the OF installations some kind of sorted.

I just changed the bashrc foamInstall option as proposed by your last post and compiled OF again (in su mode). In detail I did the following: (to prevent to waste your time again due to lack of information ;) )

1. Extract of the src code archives in /opt/OpenFOAM/ directory according to the commands from openfoamwiki.

2. Since x86_64 architecture I did:

echo "source /opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc $FOAM_SETTINGS" >> $HOME/.bashrc

3. Changed to OpenFOAM-2.1.1 directory and compiled it:


./Allwmake > make.log 2>&1
I did the 2nd run also and attached both logs to this post.

4. Built paraview according to openfoamwiki

I also attached my users bashrc and the root bashrc. I had to add the option WM_COMPILER=Gcc47 in the user bashrc in order to get openfoam tools running. The initial problem is however not solved. I compiled a library (not in sudo mode) and it finished without an error. The next library didn't compile successfully. The error is actually the same as in my first post:


wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file fiberPorousZone.C
make: *** Keine Regel vorhanden, um das Target »fiberPorousZones.dep«,
  benötigt von »Make/linux64Gcc47DPOpt/dependencies«, zu erstellen.  Schluss.
make: *** Warte auf noch nicht beendete Prozesse...

Thank you very much for helping me!

Greetings from Germany, Alex

EDIT: If i change the owner of the opt/OpenFOAM directory from root to my user, would that make things easier? I should than be able to compile OF without "su" or not?

derkermit May 16, 2013 12:22

Just tried compilation in opt/ without sudo but with changing the owner. No errors occured but when compiling my library the same message as before comes up.

I'll check the files of my library tomorrow. Maybe they got corrupted when copying them from dvd.

wyldckat May 16, 2013 17:39

Hi Alex,

OK, I think that being tired lead me to misdiagnose the problem on your first post :(

There are at least two possibilities for this error:
  1. There could be some left overs from a previous build from the original source on said DVD. To clean things up on the custom source code in question, run on it's main folder:

    wclean all
    It should clear up all files that are created at build time... including "*.dep" files.
  2. If the previous possibility doesn't fix it, then there is something outdated in the source code (e.g. if the source code was designed to work on OpenFOAM 1.7.1), or something is missing altogether.
    • My guess is that for the library that is not building, you should check the file "Make/files" and compare the file list in that files, against the files actually present on the library's folder. The file "fiberPorousZone.C" is probably missing on the file system.

Sorry about the initial misdiagnosis :(, but at least you learned a few more things about OpenFOAM's building mechanism ;)

By the way, the script code you had:

export FOAM_INST_DIR=/opt/OpenFOAM
alias of22x='foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.2.x/etc/bashrc && [ -f $foamDotFile ] && . $foamDotFile'
alias of211='foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.1.1/etc/bashrc && [ -f $foamDotFile ] && . $foamDotFile'

Should work just fine, as long as you edit the file "OpenFOAM-2.1.1/etc/bashrc" or "OpenFOAM-2.1.1/etc/" accordingly, instead of using the custom options directly in the call to "bashrc".

Best regards,

derkermit May 17, 2013 03:55

Hey Bruno,
I managed to compile it by copying the files from another source. Up to now I can't see any difference in the files. Has to be some kind of magic ;)

But as you said, I learnt a ton about compiling OpenFOAM. Thanks for guiding me!

Just a last question regarding your last statement:
What exactly is meant by "foamDotFile"? And what is the difference between


alias of211='foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.1.1/etc/bashrc && [ -f $foamDotFile ] && . $foamDotFile'


alias of211='source /opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI'

Greetings, Alex

wyldckat May 17, 2013 18:07

Hi Alex,

OK, two details:
  1. "foamDotFile" is basically a variable.
    "foamDotFile=1" defines that the variable is assigned the value "1".
    "$foamDotFile" indicates that we want to use the value assigned to the variable.
    The trick is that it will only activate the OpenFOAM environment if can find that the file exists:

    [ -f $foamDotFile ]
  2. The second alias has two further details:
    1. It's sourcing "bashrc" directly, instead of relying on a variable.
    2. It has all of the custom variable definitions done in a single line, because "bashrc" has code inside it to process these variables and assign them on-the-fly :)
A ton more details like these can be learned from online tutorials about programming scripts with/for bash.

Best regards,

derkermit May 19, 2013 03:30

Thank you for the explanation. Helped me a lot!

Greetings, Alex

All times are GMT -4. The time now is 15:55.