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

Unable to use .so library in other folder than in $FOAM_USER_LIBBIN

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2021, 12:39
Default Unable to use .so library in other folder than in $FOAM_USER_LIBBIN
  #1
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12
Saideep is on a distinguished road
Hi all,


I have an issue linking a third party library to my solver.


I have a library having named libTP.so. I placed this library in my $FOAM_USER_LIBBIN and compiled my solver. Later ran the solver. Everything works perfect. The $(FOAM_USER_LIBBIN) is the folder in $WM_PROJECT_USER_DIR/platforms/linux64GccDPInt32Opt/lib.


Now, within the $FOAM_USER_LIBBIN, I try to create a new folder named 'lp' and copy the library (libTP.so) into this folder. Duely, I make changes to the Make/options file of the solver by adding the path:
Code:
-L$(FOAM_USER_LIBBIN)/lp -lTP \
But this doesnt work and I dont understand why. I am giving the right path and the compilation is successful. When I try to run the solver I get the following missing library error which is bizarre as the compiler can find it.
Code:
cVeFoam: error while loading shared libraries: libTP.so: cannot open shared object file: No such file or directory
Can anyone let me know where am I going wrong?



Thanks!!
Saideep is offline   Reply With Quote

Old   September 15, 2021, 10:22
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
Too late, but perhaps it helps somebody else:

Your solver looks at runtime(!) in the directories given in by the environment LD_LIBRARY_PATH. This normaly includes the directory corresponding to $FOAM_USER_LIBBIN but not $FOAM_USER_LIBBIN/lp.

During compilation, to you advise the linker to look at that directory and so you get no error during linking.
So to solve your problem, you have to add this directory to LD_LIBRARY_PATH:
Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$FOAM_USER_LIBBIN/lp
jherb is offline   Reply With Quote

Reply

Tags
library


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
foamListTimes: How to select latestTime or 0/ folder petros OpenFOAM Running, Solving & CFD 1 January 28, 2021 08:11
Impose volume mesh vertex motion with external library daveatstyacht OpenFOAM Programming & Development 1 March 13, 2019 08:37
[OpenFOAM.com] v1606+ Run Folder JSMOKA OpenFOAM Installation 5 December 18, 2016 20:47
The fl process could not be started because of UDF majid_kamyab Fluent UDF and Scheme Programming 6 December 15, 2015 09:42
How to debug .so library in the source code level liqiang Main CFD Forum 2 October 23, 2006 10:29


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