Fedora Linux Support Community & Resources Center
  #1  
Old 31st May 2012, 03:59 PM
am579 Offline
Registered User
 
Join Date: May 2012
Location: UK
Posts: 2
linuxfirefox
Problem with 'ldconfig'

I am a programmer, and create some libraries which I place in '/usr/local/lib', and some apps in '/usr/local/bin'.
Before running the apps for the first time, I must do 'sudo ldconfig /usr/local/lib'; otherwise, the app won't run 'cos the loader can't link to the libs.
The problem I'm having is that sometimes the problem comes back later (after a restart) and I have to run ldconfig again. Surely it should store the result in a config file and it should be permanent ?
I was having this problem in F16 and now again in F17. I have been working this way for years on Ubuntu and OpenSuse, and not seen this problem. Once I ran ldconfig the apps worked and stayed working.

Or is there a preferred way of doing this ? I.e. is there a recommended alternative to placing my libs and apps in these locations ? Should I use a ENV setting ?

AM
Reply With Quote
  #2  
Old 31st May 2012, 04:10 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,788
linuxfirefox
Re: Problem with 'ldconfig'

You need to put a file in /etc/ld.so.conf.d that contains the path to the library.

Then, on each boot it will be used in the ldconfig, and anytime the ld.so.cache file gets rebuilt it will include the path.

forgot - the file should be named <library-name>.conf. the ".conf" is required.
Reply With Quote
  #3  
Old 31st May 2012, 04:19 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,058
linuxchrome
Re: Problem with 'ldconfig'

When placing your shared object files in non-standard locations, you should create a file /etc/ld.so.conf.d/ and name it something.conf, (i.e. my-apps.conf). In that file, just put the full path to the directory where those reside (i.e. /usr/local/lib).

Then you won't need to specify that path when running the ldconfig command, as ldconfig should use all the paths specified in the *.conf files in the /etc/ld.so.conf.d/ directory.

ldconfig stores it's data in /etc/ld.so.cache. I don't know/understand why ldconfig is losing your links from previous runs of ldconfig.
Reply With Quote
  #4  
Old 31st May 2012, 05:22 PM
am579 Offline
Registered User
 
Join Date: May 2012
Location: UK
Posts: 2
linuxfirefox
Re: Problem with 'ldconfig'

Thanks, I've done that and it works so far ! PabloTwo's comment is valid, though, I reckon...once I had used the proper ldconfig command it should remember the result indefinitely, shouldn't it ?
Reply With Quote
  #5  
Old 31st May 2012, 05:36 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,058
linuxchrome
Re: Problem with 'ldconfig'

The /sbin/ldconfig command is executable by everyone:

-rwxr-xr-x. 1 root root 960088 May 14 15:39 /sbin/ldconfig

The /etc/ld.so.cache file is writable only by root:

-rw-r--r--. 1 root root 143422 May 29 14:13 /etc/ld.so.cache

So, if you were not issuing the ldconfig command as root, it would not have saved anything to the cache file. You should always run ldconfig as root if you want the results to persist between boots. Maybe this was the problem?
Reply With Quote
  #6  
Old 1st June 2012, 06:58 PM
mschwendt Offline
Registered User
 
Join Date: Jun 2010
Posts: 312
linuxfirefox
Re: Problem with 'ldconfig'

The answer is hidden in the earlier replies. /usr/local/lib is not in the list of library search paths. Running "sudo ldconfig /usr/local/lib" adds the path for only that single run of ldconfig. That updates the ld.so.cache file correctly, but subsequent runs of ldconfig (manually or as part of RPM scriptlets) overwrite the cache and don't look in /usr/local/lib by default. Hence you've had to add the path permanently via a file in /etc/ld.so.conf.d/
Reply With Quote
  #7  
Old 2nd June 2012, 12:02 PM
goodfella Offline
Registered User
 
Join Date: Mar 2012
Location: SFBay Area
Posts: 81
linuxfirefox
Re: Problem with 'ldconfig'

What does "echo $LD_LIBRARY_PATH" say?
Should be: /usr/local/lib:/usr/lib:/lib

Just checking that you did this first.

What about:
echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:
Reply With Quote
Reply

Tags
ldconfig, problem

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
a problem with ldconfig talalek Using Fedora 1 29th December 2010 07:07 AM
Help with ldconfig ! hellboy_1 Using Fedora 2 11th April 2008 08:42 PM
ldconfig help newgenetic Using Fedora 0 29th August 2006 07:03 AM
ldconfig mugs Using Fedora 0 11th January 2006 12:35 PM
ldconfig MikeEller Using Fedora 3 27th February 2005 01:11 AM


Current GMT-time: 11:08 (Wednesday, 30-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