LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-12-2012, 07:41 PM   #1
anctop
Member
 
Registered: Feb 2010
Posts: 99

Rep: Reputation: Disabled
how to display static libraries linked in executables ?


Hi,

I'd like to know how to display the information about what static (.a) libraries have been linked in an executable.

The command "ldd" shows only dynamic libs.

I've searched the web for answers. Some suggest using the "nm" command, but I get "nm: <filename>: no symbols". I guess this is because my executables are "strip"-ed.

Any other suggestion ?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-13-2012, 01:38 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
yes, you are right, those infos can be stripped, so static libraries cannot be identified. If you knew how that execucable was built you can have the list of libraries...
 
Old 04-13-2012, 02:36 PM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by anctop View Post
Hi,

I'd like to know how to display the information about what static (.a) libraries have been linked in an executable.

The command "ldd" shows only dynamic libs.

I've searched the web for answers. Some suggest using the "nm" command, but I get "nm: <filename>: no symbols". I guess this is because my executables are "strip"-ed.

Any other suggestion ?
If executable striped then is contains only code and next to nothing additional information.

Could you explain, why you want display static libraries linked into executable,
may be there is another way to achieve what you really need.
 
Old 04-13-2012, 09:41 PM   #4
anctop
Member
 
Registered: Feb 2010
Posts: 99

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Valery Reznic View Post
If executable striped then is contains only code and next to nothing additional information.

Could you explain, why you want display static libraries linked into executable,
may be there is another way to achieve what you really need.
Thank you for your attention.

The existing "ncurses" on my system contains only static libs.
Recently I built "--with-shared" and installed the lastest version.
When I remove the old tree, some full-screen executables (e.g. emacs) do not start because they depend on the terminfo of the old tree. Now I've to keep the old terminfo branch in order to fix the problem.
I'd like to find out which executables have been linked with the old static ncurses libs, such that I can re-build them with the shared libs of the new version.
 
Old 04-14-2012, 12:25 PM   #5
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by anctop View Post
Thank you for your attention.

The existing "ncurses" on my system contains only static libs.
Recently I built "--with-shared" and installed the lastest version.
When I remove the old tree, some full-screen executables (e.g. emacs) do not start because they depend on the terminfo of the old tree. Now I've to keep the old terminfo branch in order to fix the problem.
I'd like to find out which executables have been linked with the old static ncurses libs, such that I can re-build them with the shared libs of the new version.
You can try something like this
Code:
strings -a your_executable | grep /path/to/terminfo_dir
Your static ncurses library should contain path to the directory where termiinfo files located.
You can use strings + grep to search for such string in your executables
 
2 members found this post helpful.
Old 04-14-2012, 10:42 PM   #6
anctop
Member
 
Registered: Feb 2010
Posts: 99

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Valery Reznic View Post
You can try something like this
Code:
strings -a your_executable | grep /path/to/terminfo_dir
Your static ncurses library should contain path to the directory where termiinfo files located.
You can use strings + grep to search for such string in your executables
Thank you very much. It works !
 
Old 04-14-2012, 11:46 PM   #7
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by anctop View Post
Thank you very much. It works !
Great! You are welcome
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread limits in dynamic libraries as opposed to static libraries pmkenny1234 Linux - Software 0 04-26-2011 02:22 PM
Dynamically linked libraries.. vishalbutte Programming 6 04-17-2006 08:54 PM
How to see which shared libraries are linked to a program zsjoska Linux - Newbie 2 11-19-2004 01:45 PM
Linux Dynamicly Linked Libraries sikil_nuru Programming 3 03-16-2004 07:51 AM
Static-ly Linked... Chijtska Linux From Scratch 7 02-15-2002 07:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:04 AM.

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