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

Ld_library_path

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2009, 16:50
Default Ld_library_path
  #1
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
Hello, I seemed to have figured out what was going on from my earlier post. my LD_LIBRARY_PATH ev is pointing to /usr/lib/qt4. This is fine but I also need i to point to /OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt.

Can someone tell me how to set the LD_LIBRARY_PATH with multiple paths so that OpenFOAM can find all of the neccessary libraries so that I don't have to put them all in the qt4 folder?

Thanks

Last edited by scottneh; November 21, 2009 at 10:16. Reason: [SOLVED]
scottneh is offline   Reply With Quote

Old   November 14, 2009, 19:28
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hello Scott,

I've had to trail down your posts and threads, to get a notion as to why you didn't post on the same thread...

So, by what I've gathered, you:
  • are using Gentoo;
  • managed to get the installation working in late September;
  • had some problems with Paraview during October;
And now, came November, and you forgot how you set up the environment for OpenFOAM? Because the problem you are having now, is related to the environment not being set properly!
So, you should check if your ~/.bashrc file still has the environment properly setup!

  1. If that isn't the problem, then use the command export on a terminal to get a list of environment variables currently set in your terminal, and search for the variables that start with "WM_" or "FOAM_". You can also use:
    Code:
    export | grep WM_
    export | grep FOAM_
    to get a smaller list. If there are none of these variables, then the environment wasn't properly set up! You shouldn't need to set up LD_LIBRARY_PATH by hand!
  2. If these variables are defined, check if they have the correct addresses for your OpenFOAM installation.
  3. If you want to define the LD_LIBRARY_PATH by hand, then I suggest you read the files
    Code:
    OpenFOAM/OpenFOAM-1.6/etc/settings.sh
    OpenFOAM/OpenFOAM-1.6/etc/bashrc
    There you will find most of the code that is used to setup the working environment for OpenFOAM, including how to define LD_LIBRARY_PATH.

And please, re-use your previous thread when the context is still the same... otherwise you might not get answers!

Best Regards,
Bruno
wyldckat is offline   Reply With Quote

Old   November 15, 2009, 14:19
Default
  #3
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
Bruno

Thanks for the input. I figured since they were somewhat different issues that they needed to be posted separately. Anyway I'll keep things together from now on.

Here are the results from the EV lists.

export | grep WM_

Returns

declare -x WM_ARCH="linux64"
declare -x WM_ARCH_OPTION="64"
declare -x WM_CC="gcc"
declare -x WM_CFLAGS="-m64 -fPIC"
declare -x WM_COMPILER="Gcc"
declare -x WM_COMPILER_ARCH=""
declare -x WM_COMPILER_DIR="/programs/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux64"
declare -x WM_COMPILER_LIB_ARCH="64"
declare -x WM_COMPILE_OPTION="Opt"
declare -x WM_CXX="g++"
declare -x WM_CXXFLAGS="-m64 -fPIC"
declare -x WM_DIR="/programs/OpenFOAM/OpenFOAM-1.6/wmake"
declare -x WM_LDFLAGS="-m64"
declare -x WM_LINK_LANGUAGE="c++"
declare -x WM_MPLIB="OPENMPI"
declare -x WM_OPTIONS="linux64GccDPOpt"
declare -x WM_OSTYPE="POSIX"
declare -x WM_PRECISION_OPTION="DP"
declare -x WM_PROJECT="OpenFOAM"
declare -x WM_PROJECT_DIR="/programs/OpenFOAM/OpenFOAM-1.6"
declare -x WM_PROJECT_INST_DIR="/programs/OpenFOAM"
declare -x WM_PROJECT_USER_DIR="/home/cleve/OpenFOAM/cleve-1.6"
declare -x WM_PROJECT_VERSION="1.6"
declare -x WM_THIRD_PARTY_DIR="/programs/OpenFOAM/ThirdParty-1.6"

and

export | grep FOAM_

Returns

declare -x FOAM_APP="/programs/OpenFOAM/OpenFOAM-1.6/applications"
declare -x FOAM_APPBIN="/programs/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt"
declare -x FOAM_INST_DIR="/programs/OpenFOAM"
declare -x FOAM_JOB_DIR="/programs/OpenFOAM/jobControl"
declare -x FOAM_LIB="/programs/OpenFOAM/OpenFOAM-1.6/lib"
declare -x FOAM_LIBBIN="/programs/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt"
declare -x FOAM_MPI_LIBBIN="/programs/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/openmpi-1.3.3"
declare -x FOAM_RUN="/home/cleve/OpenFOAM/cleve-1.6/run"
declare -x FOAM_SIGFPE=""
declare -x FOAM_SITE_APPBIN="/programs/OpenFOAM/site/1.6/bin/linux64GccDPOpt"
declare -x FOAM_SITE_LIBBIN="/programs/OpenFOAM/site/1.6/lib/linux64GccDPOpt"
declare -x FOAM_SOLVERS="/programs/OpenFOAM/OpenFOAM-1.6/applications/solvers"
declare -x FOAM_SRC="/programs/OpenFOAM/OpenFOAM-1.6/src"
declare -x FOAM_TUTORIALS="/programs/OpenFOAM/OpenFOAM-1.6/tutorials"
declare -x FOAM_USER_APPBIN="/home/cleve/OpenFOAM/cleve-1.6/applications/bin/linux64GccDPOpt"
declare -x FOAM_USER_LIBBIN="/home/cleve/OpenFOAM/cleve-1.6/lib/linux64GccDPOpt"
declare -x FOAM_UTILITIES="/programs/OpenFOAM/OpenFOAM-1.6/applications/utilities"
declare -x MPI_ARCH_PATH="/programs/OpenFOAM/ThirdParty-1.6/openmpi-1.3.3/platforms/linux64GccDPOpt"
declare -x MPI_HOME="/programs/OpenFOAM/ThirdParty-1.6/openmpi-1.3.3"
declare -x OPAL_PREFIX="/programs/OpenFOAM/ThirdParty-1.6/openmpi-1.3.3/platforms/linux64GccDPOpt"
declare -x PATH="/programs/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc/bin:/programs/OpenFOAM/ThirdParty-1.6/openmpi-1.3.3/platforms/linux64GccDPOpt/bin:/programs/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux64/bin:/home/cleve/OpenFOAM/cleve-1.6/applications/bin/linux64GccDPOpt:/programs/OpenFOAM/site/1.6/bin/linux64GccDPOpt:/programs/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt:/programs/OpenFOAM/OpenFOAM-1.6/wmake:/programs/OpenFOAM/OpenFOAM-1.6/bin:/usr/kde/3.5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.2:/usr/qt/3/bin"
declare -x PV_PLUGIN_PATH="/programs/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt"
declare -x ParaView_DIR="/programs/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linux64Gcc"
declare -x ParaView_INST_DIR="/programs/OpenFOAM/ThirdParty-1.6/paraview-3.6.1"
declare -x ROOTPATH="/usr/kde/3.5/sbin:/usr/kde/3.5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.2:/usr/qt/3/bin:/programs/OpenFOAM/OpenFOAM-1.6/bin"
declare -x WM_COMPILER_DIR="/programs/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux64"
declare -x WM_DIR="/programs/OpenFOAM/OpenFOAM-1.6/wmake"
declare -x WM_PROJECT="OpenFOAM"
declare -x WM_PROJECT_DIR="/programs/OpenFOAM/OpenFOAM-1.6"
declare -x WM_PROJECT_INST_DIR="/programs/OpenFOAM"
declare -x WM_PROJECT_USER_DIR="/home/cleve/OpenFOAM/cleve-1.6"
declare -x WM_THIRD_PARTY_DIR="/programs/OpenFOAM/ThirdParty-1.6"
scottneh is offline   Reply With Quote

Old   November 15, 2009, 15:15
Default
  #4
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
The paths

FOAM_USER_LIBBIN="/home/cleve/OpenFOAM/cleve-1.6/lib/linux64GccDPOpt"
WM_PROJECT_USER_DIR="/home/cleve/OpenFOAM/cleve-1.6"
FOAM_USER_APPBIN="/home/cleve/OpenFOAM/cleve-1.6/applications/bin/linux64GccDPOpt"

and anyothers that say "/home/cleve/OpenFOAM/cleve-1.6" were improperly set. They should say "/programs/OpenFOAM/OpenFOAM-1.6/...."

I looked in settings and found a few things to change in settings and bashrc. I tested the edits and

export | grep WM_
export | grep FOAM

both return the proper paths now. However, when I try to run the cavity example I still get the same error. I never did anything with a manual setting of LD_LIBRARY_PATH

The only code I saw in bashrc and cshrc was under the line "# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)" but it didn't appear to make a setting

In settings.sh I saw "alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'" but no assignment for LD_LIBRARY_PATH. Can you tell me where that assignment is located?


As for FOAM_RUN="/home/cleve/OpenFOAM/cleve-1.6/run"

I never had a "Run" folder. Am I supposed to create one or should one have been built as part of the install?

Last edited by scottneh; November 15, 2009 at 15:41.
scottneh is offline   Reply With Quote

Old   November 15, 2009, 19:49
Default
  #5
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
From what I have been reading it looks like a bad idea to modify the value of LD_LIBRARY_PATH. Is there a way to change where OpenFOAM looks for libraries without messing with LD_LIBRARY_PATH?

It looks like it is ignoring FOAM_USER_LIBBIN, FOAM_USER_APPBIN, FOAM_SITE_LIBBIN and FOAM_USER_APPBIN
scottneh is offline   Reply With Quote

Old   November 15, 2009, 20:19
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hello Scott,

Quote:
Originally Posted by scottneh View Post
FOAM_USER_LIBBIN="/home/cleve/OpenFOAM/cleve-1.6/lib/linux64GccDPOpt"
WM_PROJECT_USER_DIR="/home/cleve/OpenFOAM/cleve-1.6"
FOAM_USER_APPBIN="/home/cleve/OpenFOAM/cleve-1.6/applications/bin/linux64GccDPOpt"

and any others that say "/home/cleve/OpenFOAM/cleve-1.6" were improperly set. They should say "/programs/OpenFOAM/OpenFOAM-1.6/...."

(...)
As for FOAM_RUN="/home/cleve/OpenFOAM/cleve-1.6/run"

I never had a "Run" folder. Am I supposed to create one or should one have been built as part of the install?
Uhm, actually they were suppose to be as they were defined... the environment variables that have _USER_ are associated to your user's OpenFOAM work folder, were you'll keep your own binaries, libraries and case runs (i.e. FOAM_RUN)... so, these aren't obligatory folders, but if you make them, they will come in handy for your future case runs and software developments with OpenFOAM.
If you start following see user guide ($WM_PROJECT_DIR/doc/Guides-a4/UserGuide.pdf), chapter 2, just before the cavity tutorial, you will see that they say that you should make the folder $FOAM_RUN.


Quote:
Originally Posted by scottneh View Post
In settings.sh I saw "alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'" but no assignment for LD_LIBRARY_PATH. Can you tell me where that assignment is located?
Hold it... that is in the file settings.csh, not settings.sh!
If you use the bashrc file, settings.sh is called by it; if you use cshrc, settings.csh is called.

So, assuming you are using bashrc, in settings.sh you will have this:
Code:
# prefix to LD_LIBRARY_PATH
_foamAddLib()
{
    while [ $# -ge 1 ]
    do
        export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
        shift
    done
}
This defines a helper function for adding library paths. So any line you encounter that starts with _foamAddLib, will add that folder to the library path. For example, in settings.sh, you should have this:
Code:
_foamAddLib  $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
But this is odd... the WM_ variables and FOAM_ variables are properly set, but LD_LIBRARY_PATH doesn't get set properly? When you do:
Quote:
echo $LD_LIBRARY_PATH
Only the qt folder shows up? In your file ~/.bashrc, is:
Code:
. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
your last line?

Try this... after starting a new terminal, do the echo $LD_LIBRARY_PATH, and verify if none of the OpenFOAM folders are listed in it. If not, do on this terminal:
Code:
. $WM_PROJECT_DIR/etc/settings.sh
echo $LD_LIBRARY_PATH
If my guess is right, this fixes your problem... for this opened terminal; this means that your system calls something else after calling ~/.bashrc, which will change the LD_LIBRARY_PATH to the standard values.

I hope this fixes the issue!

Best Regards,
Bruno
wyldckat is offline   Reply With Quote

Old   November 15, 2009, 20:37
Default
  #7
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
Thanks for getting back to me.

I have separaret disks for my data and cases runs, there are two 1.5TB drives that I plan on putting all the resuts that are a mirrored RAID set so thats why I wanted to move thigns away from my home and user directories. I'll see how things run and adjust them appropriatly. I only commented out the original lines so they are still there.

It is correct that when I enter "echo $LD_LIBRARY_PATH" all I get is the qt4 directory.

I entered

.$WM_PROJECT_DIR/etc/settings.sh

and got an error saying "no such file or directory" but i can see it with ls and I can open it with nano so I know its there.

I ran she shell script with

sh settings.sh

and then

echo $LD_LIBRARY_PATH

but only the qt4 directory comes up.

Last edited by scottneh; November 15, 2009 at 21:22.
scottneh is offline   Reply With Quote

Old   November 16, 2009, 04:15
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by scottneh View Post

.$WM_PROJECT_DIR/etc/settings.sh

and got an error saying "no such file or directory" but i can see it with ls and I can open it with nano so I know its there.
Without a space between the '.' and the filename???
But you want to source the file, not execute it!

Quote:
Originally Posted by scottneh View Post
I ran she shell script with

sh settings.sh

and then

echo $LD_LIBRARY_PATH

but only the qt4 directory comes up.
With this you started a subshell, ran settings.sh and exited again. This will have absolutely no effect on your parent shell (ever!).
olesen is offline   Reply With Quote

Old   November 17, 2009, 23:30
Default
  #9
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
Looks like it worked. echo $LD_LIBRARY_PATH showed several paths and blockMesh worked. I couldn't go any further becuase I had ot run to catch a flight but it appears to be working now.

Thanks
Scott
scottneh is offline   Reply With Quote

Old   November 21, 2009, 10:15
Default
  #10
Member
 
Scott
Join Date: Sep 2009
Posts: 30
Rep Power: 17
scottneh is on a distinguished road
That worked indeed, everything is working now. Thanks for the help!
scottneh 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 16:50.