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

using $FOAM_USER_LIBBIN

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By l_r_mcglashan
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2011, 10:44
Default using $FOAM_USER_LIBBIN
  #1
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 16
linch is on a distinguished road
Hi guys,

I have a rather simple question to you:

as I made some changes in an OF library and compiled it with a new name into the $FOAM_USER_LIBBIN directory, OF couldn't find it. But as I copied the .so file manually into the $FOAM_LIBBIN directory, everything ran fine.

It's not a great problem as long as I can use the lib, but I would like to keep my stuff apart from the unchanged OF. Do I have to add the $FOAM_USER_LIBBIN directory as a look-up path somewhere in OF (1.7.x)?

Regards,
Illya
linch is offline   Reply With Quote

Old   January 11, 2011, 02:29
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by linch View Post
Hi guys,

I have a rather simple question to you:

as I made some changes in an OF library and compiled it with a new name into the $FOAM_USER_LIBBIN directory, OF couldn't find it. But as I copied the .so file manually into the $FOAM_LIBBIN directory, everything ran fine.

It's not a great problem as long as I can use the lib, but I would like to keep my stuff apart from the unchanged OF. Do I have to add the $FOAM_USER_LIBBIN directory as a look-up path somewhere in OF (1.7.x)?

Regards,
Illya
This sounds odd. If you check line 84 and line 98 of the settings.sh file:
https://github.com/OpenCFD/OpenFOAM-...tc/settings.sh
There appears to be no reason why it shouldn't find your FOAM_USER_LIBBIN.

If you echo the values
Code:
echo $LD_LIBRARY_PATH
# or
echo $LD_LIBRARY_PATH | tr ':' '\n'
I would hope that the directory corresponding to FOAM_USER_LIBBIN should also appear. If this is not the case, there is indeed something wrong.
olesen is offline   Reply With Quote

Old   January 11, 2011, 04:32
Default
  #3
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
I've always had the same. My paths are (shortened);

FOAM_LIBBIN
=
OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt

FOAM_USER_LIBBIN
=
OpenFOAM/lrm29-1.7.x/lib/linux64GccDPOpt

LD_LIBRARY_PATH
=
OpenFOAM/lrm29-1.7.x/lib/linux64GccDPOpt
OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt

but I've always had to put -L$(FOAM_USER_LIBBIN) in the EXE_LIBS part of the Make/options file when using custom libraries stored there, otherwise wmake doesn't seem to find the custom libraries.
Mars409 likes this.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   January 11, 2011, 04:54
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by l_r_mcglashan View Post
I've always had the same
...
but I've always had to put -L$(FOAM_USER_LIBBIN) in the EXE_LIBS part of the Make/options file when using custom libraries stored there, otherwise wmake doesn't seem to find the custom libraries.
Ah now I see the confusion. The LD_LIBRARY_PATH mechanism only help ldd at runtime to find the libraries. At the link stage you need to let it know where to search. The FOAM_LIBBIN is automatically added in the wmake Makefile, thus it gets found transparently. If you take a look at the fieldview9Reader Make/options you'll see a more complex example of specifying where to find things.

Summary: if you are linking against user libs, you'll need to add -L$(FOAM_USER_LIBBIN) in the Make/options regardless of what is in the LD_LIBRARY_PATH.
Mars409 likes this.
olesen is offline   Reply With Quote

Old   January 12, 2011, 04:59
Default
  #5
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 16
linch is on a distinguished road
Quote:
Originally Posted by olesen View Post
If you echo the values
Code:
echo $LD_LIBRARY_PATH
# or
echo $LD_LIBRARY_PATH | tr ':' '\n'
I would hope that the directory corresponding to FOAM_USER_LIBBIN should also appear. If this is not the case, there is indeed something wrong.
FOAM_USER_LIBBIN does not appear in the list.

Quote:
Originally Posted by olesen View Post
Summary: if you are linking against user libs, you'll need to add -L$(FOAM_USER_LIBBIN) in the Make/options regardless of what is in the LD_LIBRARY_PATH.
Thank you, it works. What do -I and -L mean?
linch is offline   Reply With Quote

Old   January 12, 2011, 05:17
Default
  #6
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by linch View Post
FOAM_USER_LIBBIN does not appear in the list.
But the value equivalent to "echo $FOAM_USER_LIBBIN" should be in the LD_LIBRARY_PATH, otherwise something is seriously wrong.

Quote:
Originally Posted by linch View Post
What do -I and -L mean?
From the gcc manpage you can see that '-Idir' is for include dirs and that '-Ldir' is for library dirs.
It is probably worth skimming this section of the manpage if you are going to be working with C/C++ at all.
olesen is offline   Reply With Quote

Old   January 12, 2011, 06:22
Default
  #7
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 16
linch is on a distinguished road
Thank you very much Mark
linch is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 19:13.