CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

compiling libraries - LIBBIN and USER_LIBBIN

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 4 Post By ngj
  • 1 Post By quarkz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 8, 2012, 10:42
Default compiling libraries - LIBBIN and USER_LIBBIN
  #1
Member
 
Join Date: Nov 2010
Posts: 41
Rep Power: 15
grjmell is on a distinguished road
So, I'm compiling a modified version of the twoPhaseEulerFoam solver. I've copied my version to a folder and compile it to $FOAM_USER_APPBIN. No problem. Within the solver there are three libraries (containing submodels) that must be compiled separately if one wishes to make changes to those submodels. I compiled the libraries to $FOAM_USER_LIBBIN, and it all works ok. If i run my modified solver it uses the modified libraries.

Now, the problem is that the original version of twoPhaseEulerFoam is also using the changed version of the libraries. I don't understand why since the original libraries and code are unaltered (unless i have overlooked something but it does not appear so), but somehow it is using my modified libraries in $FOAM_USER_LIBBIN as opposed to the original libraries in $FOAM_LIBBIN. Does anyone know why and how I can stop that from happening? I want the original solver to use the original libraries and the modified solver to use the modified libraries in USER_LIBBIN.
grjmell is offline   Reply With Quote

Old   February 8, 2012, 10:56
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Greg

I would suggest that you name those libraries in FOAM_USER_LIBBIN libmy<name>.so in stead of lib<name>.so and change the linked libraries in your modified solver accordingly.

The problem is most definitely that FOAM_USER_LIBBIN appears first in the search path for the linking, so the original solver finds your modified libraries first, because the are named the same.

Kind regards,

Niels
ngj is offline   Reply With Quote

Old   February 8, 2012, 12:50
Default
  #3
Member
 
Join Date: Nov 2010
Posts: 41
Rep Power: 15
grjmell is on a distinguished road
Thanks Niels,
I have renamed my modified libraries as suggested. When trying to link to those in the Make/options file of the actual solver, i get an error message that it can't find them. I think it's maybe a syntax thing that i've got wrong. to clarify, the original contents of my Make/options file of the solver are as below.
i compile for example a new library called libmyphaseModel (instead of the original libphaseModel). then i get libmyphaseModel.so in my USER_LIBBIN. good that works. now in my Make/options file of the solver (below), i tried changing -lphaseModel to -lmyphaseModel but I get an error message that it cannot be found. it doesnt seem to recognise the new name of the library. is my syntax wrong?

Code:
EXE_INC = \
    -I$(FOAM_SOLVERS)/multiphase/bubbleFoam \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -IturbulenceModel \
    -IkineticTheoryModels/lnInclude \
    -IinterfacialModels/lnInclude \
    -IphaseModel/lnInclude \
    -Iaveraging

EXE_LIBS = \
    -lEulerianInterfacialModels \
    -lfiniteVolume \
    -lmeshTools \
    -lincompressibleTransportModels \
    -lphaseModel \
    -lkineticTheoryModel
grjmell is offline   Reply With Quote

Old   February 8, 2012, 14:15
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Greg

Try to add the following line prior to your own libraries in Make/options:

Code:
-L$(FOAM_USER_LIBBIN) \
This tells the compiler that it ought to look in the directory $FOAM_USER_LIBBIN. This is how it works for me.

Best regards,

Niels
meshman, tonnykz, LG Liang and 1 others like this.
ngj is offline   Reply With Quote

Old   June 17, 2022, 22:06
Default
  #5
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 400
Rep Power: 19
quarkz is on a distinguished road
To make it clearer, it's like:

Code:
LIB_LIBS = \
    -lfiniteVolume \
    -lfvOptions \
    -lmeshTools \
    -ldynamicMesh \
    -loverset \
    -lfvMotionSolvers \
    -L$(FOAM_USER_LIBBIN)/mylib
Juan Daniel likes this.
quarkz is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 21:11.