How to track down all required shared libraries?

S

sdhyok

Recently, I installed many shared libraries to run a program written in
Python.
Now, I am in the situation to run the same program but on several
different machines with the same Linux OS. To avoid the reinstallation,
I like to pack up all shared libraries into a directory. Is there a
good way to track down all shared libraries required to run a Python
program?

Daehyok Shin
 
M

Mike Rovner

sdhyok said:
Recently, I installed many shared libraries to run a program written in
Python.
Now, I am in the situation to run the same program but on several
different machines with the same Linux OS. To avoid the reinstallation,
I like to pack up all shared libraries into a directory. Is there a
good way to track down all shared libraries required to run a Python
program?

Daehyok Shin

To get executable requirements use ldd.
When python can't load a lib at run-time usually ImportError is raised.
As with other errors you can never know which libs will be dynamically
required.

Mike
 
J

Jeff Epler

One poster suggests 'ldd' for executables. You can also use this on shared
libraries:
$ ldd /usr/lib/python2.3/lib-dynload/_tkinter.so
libtix8.1.8.4.so => /usr/lib/libtix8.1.8.4.so (0x009b6000)
libtk8.4.so => /usr/lib/libtk8.4.so (0x00111000)
libtcl8.4.so => /usr/lib/libtcl8.4.so (0x00539000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x00a48000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x001de000)
libc.so.6 => /lib/tls/libc.so.6 (0x001f0000)
libdl.so.2 => /lib/libdl.so.2 (0x0052d000)
libm.so.6 => /lib/tls/libm.so.6 (0x00fcf000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00656000)
If you know what shared modules your program uses, you can "ldd" them all and
find out the set of libraries they are linked to.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCdEWiJd01MZaTXX0RAvPwAJ0b51GVGM2ww5RL/Ax4qLYKyTAw9wCdHArx
yf7xuETvoVn+XPEfwB6D8Do=
=5RoY
-----END PGP SIGNATURE-----
 
M

Miki Tebeka

Hello sdhyok,
Now, I am in the situation to run the same program but on several
different machines with the same Linux OS. To avoid the reinstallation,
I like to pack up all shared libraries into a directory. Is there a
good way to track down all shared libraries required to run a Python
program?
There is a module call "modulefinder" in Python standard library. It might
do what you want.

HTH.
--
------------------------------------------------------------------------
Miki Tebeka <[email protected]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCdOcP8jAdENsUuJsRArs7AJ488mqC6ZbR0WPiQScvYWfxfePjZACgw5K5
AAqQhmq75umIo4T6TpFbTWg=
=4Som
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,097
Latest member
RayE496148

Latest Threads

Top