LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-15-2012, 06:33 AM   #1
littleplane
LQ Newbie
 
Registered: Mar 2012
Posts: 17

Rep: Reputation: Disabled
Obtain the path of a libarary from C source


My problem is how to obtain the installation place of a library on linux and do it from C source. E.g. I want to know where is libresolv.so placed. To be more tricky I cannot use system calls to run shell (that is no ldconfig, no pkconfig, etc.)
 
Old 10-15-2012, 07:38 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Can you not use 'find' or 'locate'? As far as I know (and that's not necessarily very far) the time it needs libresolv.so is when it's compiling the source - so the information would not be present in the source code, but instead in the command you used to compile the source (or in the system path, which you can obtain by running 'echo $PATH')
 
Old 10-15-2012, 07:55 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,807

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
Why do you have to know, by the way?
 
Old 10-15-2012, 08:36 AM   #4
littleplane
LQ Newbie
 
Registered: Mar 2012
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
Why do you have to know, by the way?
I'm working on a program what "chroots" a process. This process uses such shared libraries like libresolv.so, libssl.so, libcrypto.so, etc. and I need to hard link/copy them into my sandbox environment. Unfortunatelly due to some coding requirements I must not use any "shell things", so locate and find aren't possible solutions now
 
Old 10-15-2012, 09:08 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,807

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
ldd(1) is your friend
 
Old 10-15-2012, 09:34 AM   #6
littleplane
LQ Newbie
 
Registered: Mar 2012
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
ldd(1) is your friend
ldd is neither a possible way because it only lists the static but not the dynamic dependencies, that is what are loaded with dlopen().
 
  


Reply

Tags
library, linux, paths


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to obtain installation from source kallquk Linux - Newbie 1 06-22-2010 05:01 PM
what compile src and change path libarary usef62 Linux - Software 1 11-14-2008 10:44 AM
How to obtain Source Code theunixwizard Linux - Newbie 2 05-03-2008 03:28 PM
How to obtain source code in FC6 anirudhamshinde Linux - Kernel 1 01-02-2007 08:15 AM
obtain Gnome same game source code linuxmandrake General 1 12-26-2005 11:31 AM


All times are GMT -5. The time now is 01:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration