LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 12-27-2004, 01:10 AM   #1
sceadu
Member
 
Registered: Jan 2003
Posts: 76

Rep: Reputation: 15
How to check which libraries does a program use?


Hi,
I like to find out which library does a particular program use.

I have tried nm and ld but they seem to be unable to list out the libraries.

Please assist.
 
Old 12-27-2004, 01:17 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Use the ldd command on the program to list its library dependencies.
 
Old 12-27-2004, 02:46 AM   #3
sceadu
Member
 
Registered: Jan 2003
Posts: 76

Original Poster
Rep: Reputation: 15
Thanks.

The program is "helloworld.o" and when I try "ldd helloworld.o" . An error message "you do not have execution permission for ./helloworld.o not dynamic executable" appears.

Please assist.
 
Old 12-27-2004, 02:52 AM   #4
Marius2
Member
 
Registered: Jan 2004
Location: Munich
Distribution: SuSE 9.2, 10.2, 10.3, knoppix
Posts: 276

Rep: Reputation: 31
Do it as root.
 
Old 12-27-2004, 03:00 AM   #5
leonidg
Member
 
Registered: Dec 2004
Posts: 73

Rep: Reputation: 15
You should check the executable file (a.out for example) and not the object
 
Old 12-27-2004, 03:09 AM   #6
sceadu
Member
 
Registered: Jan 2003
Posts: 76

Original Poster
Rep: Reputation: 15
Sorry that I didn't gave this information early.

I wrote helloworld as a kernel program.
 
Old 12-27-2004, 04:46 AM   #7
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally posted by sceadu Sorry that I didn't gave this information early.

I wrote helloworld as a kernel program.
Then you'll need to run it as such...
 
Old 12-27-2004, 07:39 PM   #8
sceadu
Member
 
Registered: Jan 2003
Posts: 76

Original Poster
Rep: Reputation: 15
Hi,

Thanks for all the help. My apologises about insufficient information.

Here's the details.

The helloworld program is written to be ran as a kernel program in a stripped down linux (Trinux).

In this stripped down linux, there is no libraries and lsmod shows no module loaded.

Therefore, in order to run the helloworld program that contains "printk" and netfilter commands, I have to load in the appropriate libraries.

Hence, the question on how to check which libraries does a program use.

Please advise.

 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking program with .a libraries rudy2 Programming 2 04-22-2005 05:36 AM
How to check what libraries are installed? Palamides Linux - Software 3 01-06-2005 07:28 PM
how to find out what libraries and whatnot a program uses? Smokey Slackware 9 08-05-2004 06:43 PM
Program not finding java VM libraries gtanghookup Linux - Software 5 09-04-2003 01:20 AM
how to check libraries you have quickly? yocompia Slackware 3 08-21-2003 04:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:37 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration