CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   library compilation (http://www.cfd-online.com/Forums/openfoam-programming-development/91062-library-compilation.html)

foamer July 29, 2011 04:54

library compilation
 
Hi, i am quite new to openfoam.
i have looked in the user manual to compile a dynamic library, that is to issue the command wmake libso.

the error message i receive is:

Making dependency list for source file twoPhaseEulerFoam.C
could not open file createRASTurbulence.H for source file twoPhaseEulerFoam.C
could not open file wallFunctions.H for source file twoPhaseEulerFoam.C
could not open file wallDissipation.H for source file twoPhaseEulerFoam.C
could not open file wallViscosity.H for source file twoPhaseEulerFoam.C
SOURCE=twoPhaseEulerFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I../bubbleFoam -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -IturbulenceModel -IkineticTheoryModels/lnInclude -IinterfacialModels/lnInclude -IphaseModel/lnInclude -Iaveraging -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/twoPhaseEulerFoam.o
In file included from twoPhaseEulerFoam.C:54:
createFields.H:131: fatal error: createRASTurbulence.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/twoPhaseEulerFoam.o] Error 1


the Allwmake command gives me:
Allwclean: command not found

typing wmake does neither give me much...


could someone please help me ?

alex

bigphil July 29, 2011 05:48

Hi,


You are correct "wmake libso" is used to compile a dynamic library but wmake needs to know the location of all the header files. Also you need to be inside the library directory when you execute wmake libso.

Quote:

could not open file createRASTurbulence.H for source file twoPhaseEulerFoam.C
could not open file wallFunctions.H for source file twoPhaseEulerFoam.C
could not open file wallDissipation.H for source file twoPhaseEulerFoam.C
could not open file wallViscosity.H for source file twoPhaseEulerFoam.C
This error shows that wmake cannot find some of the files.
You can specify which directories wmake will search by putting their location in the Make/options file.

Also, isn't twoPhasaEulerFoam a solver? not a library? Solvers are compiled with the wmake command (or in the case of twoPhaseEulerFoam, you use the ./Allwmake script inside the solver directory which also compiles the included libraries).


Philip

foamer July 29, 2011 06:22

Yes, twoPhaseEulerFoam is a solver, not a library.

I tried Allwmake inside the solver directory but then i receive the answer: Allwmake: command not found

i have done some modifications in the solver..




alex

bigphil July 29, 2011 06:26

Oh OK, you need to use "./Allwmake" (ie not "Allwmake"). The dot forward slash uses the Allwmake in the current directory.

Philip

foamer July 29, 2011 08:43

Sorry Philip, my bad. i should have understood.. thank you very much.

At least it tried to compile this time, but i get the same error again (at the end):

could not open file createRASTurbulence.H for source file twoPhaseEulerFoam.C
could not open file wallFunctions.H for source file twoPhaseEulerFoam.C
could not open file wallDissipation.H for source file twoPhaseEulerFoam.C
could not open file wallViscosity.H for source file twoPhaseEulerFoam.C

I have serious problems finding the paths to the files.
Could you please help me out ?

alex

bigphil July 29, 2011 09:04

Alex,

OK try to compile each part separately to see if we can isolate the problem, so if you look in the Allwmake script (using a text editor like emacs) you will see:
Code:

wmake libso phaseModel
wmake libso interfacialModels
wmake libso kineticTheoryModels
wmake

The first three lines compile the libraries and the fourth line compiles the solver and links the libraries to the solver.

So first try:
wmake libso phaseModel
and see if you get any errors,
then do the second line and so on... and then we will find which part is at fault.

Philip

foamer July 29, 2011 09:25

Hi

I think that all of them gave me some kind of error, but i am going to let out all that is about kinetic theory. so no need to worry about that.

alex

bigphil July 29, 2011 09:43

Alex,

If you try: wmake libso phaseModel
and then paste the output here, and I will see if anything looks strange.

By the way, did twoPhaseEulerFoam compile correctly before you made modifications?

Philip

foamer July 29, 2011 09:51

Hi

The error message i got was:

/usr/bin/ld: cannot open output file /opt/openfoam171/lib/linux64GccDPOpt/libphaseModel.so: Permission denied
collect2: ld returned 1 exit status
make: *** [/opt/openfoam171/lib/linux64GccDPOpt/libphaseModel.so] Error 1


Yes, twoPhaseEulerFoam compiled correctly before the mods.

alex

bigphil July 29, 2011 10:08

Alex,

OK it is a permissions problem, wmake is trying to put the compiled libraries in a directory for which you do not have permission.
So to fix it, we just have to tell wmake to put the libraries in your $FOAM_USER_LIBBIN instead of $FOAM_LIBBIN.

In phaseModels/Make/files, change
LIB = $(FOAM_LIBBIN)/libphaseModel
to
LIB = $(FOAM_USER_LIBBIN)/libphaseModel

Then do the same in interfacialModels/Make/files and kineticTheoryModels/Make/files.

Now try wmake libso phaseModels and it should compile fine.

Also you have to tell your solver to use your libraries, so in the solver Make/options (ie twoPhaseEulerFoam/Make/options), add the following bold line:

Code:

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -lEulerianInterfacialModels \
    -lfiniteVolume \
    -lmeshTools \
    -lincompressibleTransportModels \
    -lphaseModel \
    -lkineticTheoryModel \
    -llduSolvers

Now hopefully ./Allwmake should run fine.

Philip

foamer July 29, 2011 10:28

Hi

After i had added USER to the different models i tried wmake libso phaseModels and i got the following error:

wmake error: could not change to directory 'phaseModels'


alex

bigphil July 29, 2011 10:42

Alex,

you should be in the directory above the library when you execute wmake libso phaseModels (ie you should be in the twoPhaseEulerFoam directory where Allwmake is when you execute wmake libso phaseModels).

The error you received means wmake cannot find the phaseModels directory in the current directory.

Philip

foamer July 29, 2011 10:50

Hmm

strange because i issued the command in the following directory:

user@user-VirtualBox:~/OpenFOAM/user...haseEulerFoam$ wmake libso phaseModels


alex

foamer July 29, 2011 10:51

sorry for that

i issued the command inside the twoPhaseEulerFoam directory.

alex

bigphil July 29, 2011 10:52

Hmnnn yes strange, OK try:

cd phaseModels
wmake libso

Philip

foamer July 29, 2011 10:55

Hi

i got the following message after typing wmake libso inside phaseModels:

wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file phaseModel/phaseModel.C
SOURCE=phaseModel/phaseModel.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/phaseModel.o
'/home/user/OpenFOAM/user-1.7.1/lib/linux64GccDPOpt/libphaseModel.so' is up to date.


alex

bigphil July 29, 2011 10:59

Great, that means it compiled fine.

Now compile the other two libraries and then the solver.

Philip

bigphil July 29, 2011 11:08

Oh and also I just realises why "wmake libso phaseModels" didn't work, it is because the library directory is called phaseModel not phaseModels.

So "wmake libso phaseModel" will work in the solver directory.

Philip

foamer July 29, 2011 11:12

Hi

the libraries compiled fine, but when i tried to compile the solver by issuing wmake inside the twoPhaseEulerFoam directory i got the following message:

Making dependency list for source file twoPhaseEulerFoam.C
could not open file createRASTurbulence.H for source file twoPhaseEulerFoam.C
could not open file wallFunctions.H for source file twoPhaseEulerFoam.C
could not open file wallDissipation.H for source file twoPhaseEulerFoam.C
could not open file wallViscosity.H for source file twoPhaseEulerFoam.C
SOURCE=twoPhaseEulerFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I../bubbleFoam -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -IturbulenceModel -IkineticTheoryModels/lnInclude -IinterfacialModels/lnInclude -IphaseModel/lnInclude -Iaveraging -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/twoPhaseEulerFoam.o
In file included from twoPhaseEulerFoam.C:54:
createFields.H:131: fatal error: createRASTurbulence.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/twoPhaseEulerFoam.o] Error 1


alex

bigphil July 29, 2011 11:31

Alex,

OK we're back to the original error that wmake cannot find some files. wmake looks in the directories specified in the solver Make/options file. What does your options file look like?
It should be:
Code:

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -IturbulenceModel \
    -IkineticTheoryModels/lnInclude \
    -IinterfacialModels/lnInclude \
    -IphaseModel/lnInclude \
    -Iaveraging

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -lEulerianInterfacialModels \
    -lfiniteVolume \
    -lmeshTools \
    -lincompressibleTransportModels \
    -lphaseModel \
    -lkineticTheoryModel \
    -llduSolvers

Philip


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