Fedora Linux Support Community & Resources Center
  #1  
Old 16th September 2011, 12:47 PM
nerak99 Offline
Registered User
 
Join Date: Aug 2006
Posts: 81
linuxchrome
add to $LD_LIBRARY_PATH

I wanted to add something to the above path and so I added a file loacl_cuda.conf to /etc/ld.so.conf.d with these contents

/usr/local/cuda/lib64:/usr/local/cuda/lib

however of I do echo $LD_LIBRARY_PATH (after ldconfig and also reboot) I just get

echo $LD_LIBRARY_PATH
/usr/lib64/alliance/lib

Now there is quite a lot of stuff in /etc/ld.so.conf.d

alliance.conf kicad.conf tclx-x86_64.conf
atlas-x86_64.conf llvm-i386.conf tix-x86_64.conf
codeblocks-contrib-x86_64.conf llvm-x86_64.conf wine-32.conf
ctapi-x86_64.conf local_cuda.conf wine-64.conf
kernel-2.6.40.3-0.fc15.x86_64.conf mysql-x86_64.conf xulrunner-64.conf
kernel-2.6.40.4-5.fc15.x86_64.conf octave-x86_64.conf
kernel-2.6.40-4.fc15.x86_64.conf qt-x86_64.conf


and so I would expect echo $LD_LIBRARY_PATH to return quite a lot.

What am I doing wrong?
Reply With Quote
  #2  
Old 16th September 2011, 01:54 PM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,075
windows_xp_2003firefox
Re: add to $LD_LIBRARY_PATH

$LD_LIBRARY_PATH is used to override the configuration in /etc/ld.so.conf.d. Normally it's empty. See "man ld.so".
Reply With Quote
  #3  
Old 16th September 2011, 02:02 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,771
linuxfedorafirefox
Re: add to $LD_LIBRARY_PATH

That isn't what LD_LIBRARY_PATH is.

LD_LIBRARY_PATH is nothing more than an environment variable of the shell.

It is used by ld and ld.so as one of the sources to locate libraries during linking. Keyword - ONE - of the sources.

LD_LIBRARY_PATH is used to add MORE libraries. It doesn't define WHAT libraries to search.

Therefore it may be empty or even not defined.

Mine only adds /usr/lib64/alliance/lib:/usr/lib64/alliance/lib. And that is it, as defined in /etc/profile.d/alc_env.sh (Alliance CAD system environment).

Otherwise it would be undefined.
Reply With Quote
  #4  
Old 17th September 2011, 01:12 AM
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 46
Posts: 3,936
linuxfirefox
Re: add to $LD_LIBRARY_PATH

if ldconfig is not setting it you could manually add it to the bash profile
take a look at the /etc/profile

and add a listing for LD_LIBRARY_PATH
and then export it
or for a USER ONLY add it to your ~/.bashrc
-------------
LD_LIBRARY_PATH ="/usr/local/cuda/lib64:/usr/local/cuda/lib"
export LD_LIBRARY_PATH
--------------

but fedora normally dose not use the "local" folder
most of the time you edit the "--prefix=" option on building the code to make sure it dose NOT install there .
__________________
OpenSUSE 13.1-64bit & Scientific Linux 6.5-64bit ( fedora 4 to 11) and 19/20 on KVM
My Celestia Downloads

h t t p ://celestiamotherlode.net/catalog/show_creator_details.php?creator_id=10

Last edited by JohnVV; 17th September 2011 at 01:19 AM.
Reply With Quote
  #5  
Old 17th September 2011, 12:37 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,771
linuxfedorafirefox
Re: add to $LD_LIBRARY_PATH

ldconfig cannot set it. It does USE it if provided.

/usr/local is INTENDED for that use.

And you can add /usr/local/lib to ldconfig so that you don't need LD_LIBRARY_PATH.

LD_LIBRARY_PATH is more for development use, not production.

Where is is used for some applications, you can define in a /etc/profile.d/<file>.<shellname> Where <shellname> is usually .sh or .csh.

Once there, it will be defined for every login.
Reply With Quote
  #6  
Old 18th September 2011, 09:39 AM
weitjong Online
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 936
macosfirefox
Re: add to $LD_LIBRARY_PATH

Quote:
Originally Posted by jpollard View Post
LD_LIBRARY_PATH is more for development use, not production
I am not entirely agree with the above statement. I know a few third party applications in PROD that will only work when the LD_LIBRARY_PATH environment variable is being set according to the respective application's expectation. Oracle is one good example.

Usually I define/export environment variables in the user's profile.

However, if you really only need this during development OR that you only need this environment variable to be set for a specific executable then you could just define it at the time you execute it.
Code:
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib your-executable
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 
Reply With Quote
  #7  
Old 18th September 2011, 09:55 AM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,696
linuxfedorafirefox
Re: add to $LD_LIBRARY_PATH

Quote:
Originally Posted by weitjong View Post
I am not entirely agree with the above statement. I know a few third party applications in PROD that will only work when the LD_LIBRARY_PATH environment variable is being set according to the respective application's expectation. Oracle is one good example.
JPollard is right. It's a poor practice to use LD_LIBRARY_PATH for production as it has security implications and can causes problems.. In a controlled environment it's OK for testing, but it's a jack-ass unexpandable scheme for production.

Oracle is (unsurprisingly) a bad example of how things should be done on Linux. OFTEN the companies that require use of LD_LIBRARY_PATH have back-ported a Windows product to Linux and don't spend the effort to do a good job.

Quote:
Usually I define/export environment variables in the user's profile.
If anyone can get to that profile file, or to the library it points to - then all security for your account is gone.
There are other exploits as well.

Since you don't want to listen to people on this forum - try to google the issue.

http://xahlee.org/UnixResource_dir/_/ldpath.html
http://blogs.oracle.com/rie/date/20040710
http://linuxmafia.com/faq/Admin/ld-lib-path.html
http://blogs.oracle.com/ali/entry/av...brary_path_the
http://www.eyrie.org/~eagle/notes/rpath.html
http://stick.gk2.sk/blog/2009/10/wro..._library_path/
and thousands more.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 18th September 2011 at 10:13 AM.
Reply With Quote
  #8  
Old 18th September 2011, 10:42 AM
weitjong Online
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 936
macosfirefox
Re: add to $LD_LIBRARY_PATH

Hi Stevea. Glad that you care to join. Thanks for the links for the security concerns about LD_LIBRARY_PATH but I think I have read the concern somewhere else. Unless I can get the source code from those third party (commercial) applications and fix those path problem, I have to define the LD_LIBRARY_PATH even if it is bad or evil to keep the apps happy. May be you own your own company, but I believe there are many like me that don't have a say on which apps to use or reject.

In case that miss you. We are here to help the original OP with his problem to add the entries into LD_LIBRARY_PATH.

If someone could get into my user's profile then yes, I agree with you totally that all bets are lost.
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 

Last edited by weitjong; 18th September 2011 at 11:38 AM.
Reply With Quote
  #9  
Old 18th September 2011, 12:38 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,771
linuxfedorafirefox
Re: add to $LD_LIBRARY_PATH

LD_LIBRARY_PATH is never required. Doing something like this is what ld_cache was created for. Trusted application libraries can be added.

There has even been some discussion (the URL got deleted when the web site went away) to removing it from being considered.
Reply With Quote
  #10  
Old 18th September 2011, 03:42 PM
weitjong Online
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 936
macosfirefox
Re: add to $LD_LIBRARY_PATH

Quote:
Originally Posted by jpollard View Post
LD_LIBRARY_PATH is never required.
If by that, you mean that it should be "avoided" when you have the option to do so then I agree. Don't get me wrong, I am not advocating the usage of LD_LIBRARY_PATH. If OP has the option to rebuild the application (compile and link to the shared library correctly) then he would have never need LD_LIBRARY_PATH in the first place. But what if that is not an option.

I have not tried ld_cache before. I quickly googled it. Correct me if I am wrong, it seems that it effects the whole system. What if in a PROD server, different users need to use different version of the 3rd party libraries, will ld_cache support that?
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 
Reply With Quote
  #11  
Old 18th September 2011, 04:45 PM
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,102
linuxfedorafirefox
Re: add to $LD_LIBRARY_PATH

Quote:
Originally Posted by weitjong View Post
If by that, you mean that it should be "avoided" when you have the option to do so then I agree. Don't get me wrong, I am not advocating the usage of LD_LIBRARY_PATH. If OP has the option to rebuild the application (compile and link to the shared library correctly) then he would have never need LD_LIBRARY_PATH in the first place. But what if that is not an option.

I have not tried ld_cache before. I quickly googled it. Correct me if I am wrong, it seems that it effects the whole system. What if in a PROD server, different users need to use different version of the 3rd party libraries, will ld_cache support that?
good point, and this is exactly why LD_LIBRARY_PATH exists. The fact that some apps may misuse it is not really that concerning (except it upsets people like stevea). setuids ignore LD_LIBRARY_PATH so it's no more a security risk than $PATH or having access to a compiler for your account.
Reply With Quote
Reply

Tags
$ld_library_path

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
where is LD_LIBRARY_PATH set? drlo1 Using Fedora 2 16th August 2011 01:44 AM
Ld_library_path daviddoria Using Fedora 1 18th August 2008 07:56 PM
Ld_library_path mahina Using Fedora 2 5th August 2007 04:17 PM
how to set LD_LIBRARY_PATH? blursotong Using Fedora 4 16th September 2005 08:13 PM


Current GMT-time: 16:03 (Wednesday, 23-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat