fatal relocation error when import shared libs on SOlaris 2.6

Randall Hopper aa8vb at yahoo.com
Mon Oct 11 09:30:52 EDT 1999


James L. Preston:
 |I have a new SPARCStation running Solaris 2.6, and I have been installing
...
 |My problem is with extension modules, i.e. PIL and Numeric. If I import
 |_imaging or multiarray, for example, I get a message like:
 |
 |ImportError: ld.so.1: python: fatal: relocation error: file
 |./multiarraymodule.so: symbol PySequence_Length: referenced symbol not
 |found
 |
 |Basically, it appears that the shared object module (multiarray.so, for
 |example) is calling functions from libpython, or somewhere else, but they
 |don't get found.  I am using gnu ld and the configuration scripts for the
 |modules generate the link command "ld -G" for generating the .so files.
 |
 |Should I generate a libpython.so in /usr/local/lib? Or is there some
 |other problem?

Sounds like your multiarray.so is dynamically linked with libpython.so.
But when something loads multiarray.so, the dynamic linker doesn't know
where to find the dependent lib libpython.so.

This is an RPATH problem.  Here is the solution and a couple alternative
hacks:

1) Relink multiarray.so and this time specify an RPATH to where
   libpython.so lives (i.e. on Solaris, add "-R /usr/local/lib")

2) (Hack) Force multiarray.so to link with the static python library
   (i.e. libpython.a)

3) (Hack) Set LD_LIBRARY_PATH at run-time to include /usr/local/lib

4) Augment the system dynamic linker path to include /usr/local/lib
   (man ldconfig).

Randall




More information about the Python-list mailing list