Results 1 to 7 of 7
Hello all,
I am using Ubuntu 10.04 64bit. I got problems when trying to add LD_LIBRARY_PATH as a global environment variable.
Code:
export LD_LIBRARY_PATH=/usr/local/Coin/lib:$LD_LIBRARY_PATH
I tried adding the above line ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-31-2011 #1Just Joined!
- Join Date
- Feb 2011
- Location
- Canada
- Posts
- 10
[SOLVED] cannot set LD_LIBRARY_PATH in ~/.profile, /etc/profile
Hello all,
I am using Ubuntu 10.04 64bit. I got problems when trying to add LD_LIBRARY_PATH as a global environment variable.
I tried adding the above line to ~/.profile and /etc/profile, logged out and in, but neither of them worked.Code:export LD_LIBRARY_PATH=/usr/local/Coin/lib:$LD_LIBRARY_PATH
Actually I want to run a program from the graphical environment which needs to find the shared library from /usr/local/Coin/lib.
Adding the above line to ~/.bashrc or /etc/bash.bashrc can make the LD_LIBRARY_PATH visible in the command line, but not global. So the program wouldn't see the path and wouldn't start.
I can start the program from the command line to get around this problem. But just curious why that happened and how we can fix it?
It seems that the LD_LIBRARY_PATH is either reset during the system startup , or ignored in ~/.profile and /etc/profile.
Any idea about this? Thank you very much.
- 03-31-2011 #2
Hmm. So, if you add the above variable to /etc/profile, log-in and out, you can't see the path listed?
If your trying to install Coin3D, make sure the other important variables are set too:Code:echo $LD_LIBRARY_PATH
Try throwing the above into one of your startup scripts. Let me know how it goes!Code:export COINDIR=/usr/local/Coin export PATH=$PATH:/usr/local/Coin/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COINDIR/lib
- 03-31-2011 #3Just Joined!
- Join Date
- Feb 2011
- Location
- Canada
- Posts
- 10
When I add the variable to /etc/profile or ~/.profile, log-in and out,
, it shows nothing. And adding the variable to bashrc shows the variable in the command-line but not visible to desktop programs.Code:echo $LD_LIBRARY_PATH
I did set all the important variable you mentioned there. All the variables work fine except for LD_LIBRARY_PATH.
I am running a program which calls the library of Coin3D. I can start the program from command-line where the LD_LIBRARY_PATH is visible but not directly from desktop. Curious about if there's anyway to set the LD_LIBRARY_PATH globally.
Thank you
- 03-31-2011 #4
Damn.. That's strange, all you should need to do (from what I know of) to set a global variable is use the export command. I'll do some more research on this once I get out of work. This is bugging me now.
One thing you could try doing as a workaround is make symbolic links in the '/usr/lib' directory to the library .so files in '/usr/local/Coin/lib'. The linker should be checking /usr/lib and will find them there. Actually, unless I'm mistaken, I believe the majority of data in there are actually sym links.
Just an idea, hopefully we can get to the root of the problem.
- 03-31-2011 #5Just Joined!
- Join Date
- Feb 2011
- Location
- Canada
- Posts
- 10
Thank you for you suggestion on the "symbolic" workaround, actually I tried before and it worked. And yes most data there are sym links.
Wait..I think I just found the doc about the problem.
From "https://help.ubuntu.com/community/EnvironmentVariables/"
I will look into it and find a way out.Since Ubuntu 9.04 Jaunty Jackalope, LD_LIBRARY_PATH cannot be set in $HOME/.profile, /etc/profile, nor /etc/environment files. You must use /etc/ld.so.conf.d/*.conf configuration files. See Launchpad bug #366728 for more information.
Last edited by ifonly; 03-31-2011 at 05:51 PM.
- 03-31-2011 #6Just Joined!
- Join Date
- Feb 2011
- Location
- Canada
- Posts
- 10
Following that link "https://help.ubuntu.com/community/EnvironmentVariables" and related bug reports, I tried two workarounds to set LD_LIBRARY_PATH a gnome global environment variable. I list them here for who is interested in it. They both worked
. Thank you for your help Nagarjuna~
-
- Add the ld.so configuration file:
(note that, "/usr/local/Coin/lib" is the runtime library path that I want to add in the LD_LIBRARY_PATH as a global enrironment variable. While libcoin.conf is a new file I created, it can be whatever name)Code:echo "/usr/local/Coin/lib" | sudo tee /etc/ld.so.conf.d/libcoin.conf
- Then we need update the cache
Code:sudo ldconfig -v
- Add the ld.so configuration file:
- Add LD_LIBRARY_PATH in ~/.profile or /etc/profile.
Then open /etc/X11/Xsession.options, changetoCode:use-ssh-agent
Then log out and in.Code:no-use-ssh-agent
- 03-31-2011 #7
Hey, you did it all your self! I'm happy you found the solution to your issue.
It's good to know about this /etc/ld.so.conf.d/ directory. This might come in use if I ever run a Ubuntu machine.
Have fun.



