CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   OF-1.6.x applications don't compile, although rest does (http://www.cfd-online.com/Forums/openfoam-installation/77067-1-6-x-applications-dont-compile-although-rest-does.html)

gwierink June 11, 2010 11:21

OF-1.6.x applications don't compile, although rest does
 
Dear all,

I am compiling OpenFOAM-1.6.x on a cluster with Scientific Linux 4 (64 bit). After some effort things seemed to work as ThirdParty compiled (except parMGridGen, but I don't think I need it), openmpi-1.3.3 compiled, Pstream compiled, OpenFOAM-1.6.x/src compiled, so I thought I was all set. But now applications need to be compiled and I get an error. When the script goes to
Code:

wmake all solvers
ld complains it can't find "-l/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x" (which is my home dir on the cluster) with the follwoing error:

Code:

+ wmake all solvers
+ wmake laplacianFoam
Making dependency list for source file laplacianFoam.C
make[1]: Entering directory `/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/applications/solvers/basic/laplacianFoam'
SOURCE=laplacianFoam.C ;  g++ -m64 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude -IlnInclude -I. -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src//homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/laplacianFoam.o
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H: In function ‘int main(int, char**)’:
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable ‘momentumPredictor’
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable ‘fluxGradp’
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H:12: warning: unused variable ‘transonic’
g++ -m64 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude -IlnInclude -I. -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src//homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude  -fPIC Make/linux64GccDPOpt/laplacianFoam.o -L/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt \
    -lfiniteVolume -l/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x -liberty -ldl  -lm -o /homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/laplacianFoam
/usr/bin/ld: cannot find -l/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x
collect2: ld returned 1 exit status

I have looked through many threads where ld can't find -l<thisAndThat>, but I am having trouble solving the issue. Would anyone have a suggestion how to fix this? The thing that I think is weird, is that everything else compiles, except the actual solvers.

Thank you in advance!

akidess June 11, 2010 12:02

I haven't used 1.6 myself, but this looks odd to me. "/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x" is not a library, so it doesn't seem surprising ld would complain. From the output I get using 1.5 I'd expect to see "-lOpenFOAM" there instead. Hope this helps.

- Anton

gwierink June 11, 2010 12:34

Hi Anton,

Quote:

I'd expect to see "-lOpenFOAM" there instead
Could it be an environment variable that is not set or set to some wrong place?

wyldckat June 11, 2010 17:46

Greetings Gijsbert,

If I interpreted correctly, Scientific Linux is based on Enterprise Linux... which I can only assume it's Red Hat Enterprise Linux. And Fedora is somewhat based on Red Hat Linux, sooo... You probably need the following solution (from OpenFOAM-1.5-dev SVN15xx with gcc-4.4.2):
Quote:

Originally Posted by philippose (Post 241685)
The current solution to the problem is, to use the -P directive when invoking cpp.

I modified the file: OpenFOAM-1.5-dev/wmake/rules/linuxGcc/general to incorporate this change, and the compile went through fine....

Code:

CPP        = /lib/cpp $(GFLAGS) -P  <-- Changed line
LD        = ld -melf_i386

PROJECT_LIBS = -l$(WM_PROJECT) -ldl

include $(GENERAL_RULES)/standard

include $(RULES)/X
include $(RULES)/c
include $(RULES)/c++


In your case, the base folder is OpenFOAM-1.6.x.

I say this solution (and it's strange that the building procedure didn't break sooner) is because there is more then one miss-definition in the output that you posted... more specifically this:
Code:

-I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src//homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lnInclude
The two paths got merged in a very bad way :( So, my hunch is that the file "laplacianFoam/Make/options" (and similar others) is either corrupted (missing one or more "\") or that your Scientific Linux installation needs the "-P" argument for running gcc and thus interpreting the options files correctly!


If you want instructions on how to build OpenFOAM 1.6.x in Fedora type Linux... er, Red Hat Linux type I suppose, here it is:
Quote:

Originally Posted by from my signature's link
Fedora 12 using the system gcc 4.4.3 (it's not a complete tutorial): Problem Installing OF 1.6 Ubuntu 9.10 (64 bit) - How to use GCC 4.4.1 post #11

Best regards,
Bruno

alberto June 12, 2010 13:32

I would think it depends on the system myself. I do not have this problem on SUSE Linux Enterprise or openSUSE (gcc 4.4.1).

gwierink June 14, 2010 07:03

Dear Anton, Bruno, and Alberto,

Many thanks for your replies!

Quote:

Scientific Linux is based on Enterprise Linux... which I can only assume it's Red Hat Enterprise Linux
Yep, that is correct.

I changed the WM_PROJECT environment variable to "OpenFOAM", as Anton mentioned, so the
Quote:

"/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x" is not a library
got solved.
I also added the -P flag, as Bruno suggested.


I recompiled the whole lot, including ThirdParty, but still get an error when compiling lalacianFoam (that's just the random solver I started compiling first):

Code:

[wierink_g@lclth01 basic]$ wmake laplacianFoam
Making dependency list for source file laplacianFoam.C
SOURCE=laplacianFoam.C ;  g++ -m64 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt -IlnInclude -I. -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOptOPENMPI/laplacianFoam.o
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H: In function ‘int main(int, char**)’:
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable ‘momentumPredictor’
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable ‘fluxGradp’
/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude/readSIMPLEControls.H:12: warning: unused variable ‘transonic’
g++ -m64 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40 -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt -IlnInclude -I. -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude -I/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude  -fPIC Make/linux64GccDPOptOPENMPI/laplacianFoam.o -L/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOptOPENMPI \
    -lfiniteVolume -lOpenFOAM -liberty -ldl  -lm -o /homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/laplacianFoam
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [/homelth/wierink_g/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/laplacianFoam] Error 1

Now ld complians it can't find lfiniteVolume ...

Would anyone have any idea? Thanks in advance!

akidess June 14, 2010 07:13

Are you sure OpenFOAM compiled properly with no errors?

Check if the finite volume library is present in (I'm assuming the library path didnt change from 1.5 here):
OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libfiniteVolume.so

If it is there, the system doesn't know where to find the OpenFOAM libraries. There might be another $WM variable you have to set, and appending LD_LIBRARY_PATH might also be worth a try.

gwierink June 15, 2010 02:14

Dear friends,

Thank you for your support. The problem got solved. It turned out that some ThirdParty things (openmpi in particular) seemed to compile ok, but didn't link. I then compiled openmpi "by hand" (as in not by script) and it worked. Also, I had a typo in bashrc :o , if that isn't embarrassing, I don't know what is ... After some fiddling, it works!


All times are GMT -4. The time now is 09:56.