LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to display static libraries linked in executables ? (http://www.linuxquestions.org/questions/linux-general-1/how-to-display-static-libraries-linked-in-executables-939549/)

anctop 04-12-2012 07:41 PM

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 ?

pan64 04-13-2012 01:38 AM

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...

Valery Reznic 04-13-2012 02:36 PM

Quote:

Originally Posted by anctop (Post 4651453)
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.

anctop 04-13-2012 09:41 PM

Quote:

Originally Posted by Valery Reznic (Post 4652051)
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.

Valery Reznic 04-14-2012 12:25 PM

Quote:

Originally Posted by anctop (Post 4652239)
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

anctop 04-14-2012 10:42 PM

Quote:

Originally Posted by Valery Reznic (Post 4652647)
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 !

Valery Reznic 04-14-2012 11:46 PM

Quote:

Originally Posted by anctop (Post 4652992)
Thank you very much. It works !

Great! You are welcome


All times are GMT -5. The time now is 08:47 AM.