[Python-Dev] Handling linker scripts reached when dynamically loading a module

Howard B. Golden howard_b_golden at yahoo.com
Sun Sep 11 01:35:19 CEST 2011


On Sun, 2011-09-11 at 00:39 +0200, Nadeem Vawda wrote:
> I can confirm that libpthread.so (/usr/lib/x86_64-linux-gnu/libpthread.so)
> is a linker script on my Ubuntu 11.04 install. This hasn't ever caused me
> any problems, though.
> 
> As for why distributions do this, here are the contents of the script:
> 
>     /* GNU ld script
>        Use the shared library, but some functions are only in
>        the static library, so try that secondarily.  */
>     OUTPUT_FORMAT(elf64-x86-64)
>     GROUP ( /lib/x86_64-linux-gnu/libpthread.so.0
> /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a )
> 
> Cheers,
> Nadeem

Let me clarify: This will only be a problem when using a foreign
function interface to call a non-versioned module dynamically. In the
more common situation, when one links to a package specified at link
time, the linker figures out the specific, versioned name of the .so
file and then the dlopen will refer to the actual binary.

So, in Python, this is likely to only affect users calling packages
using ctypes. (This corresponds to GHCi loading an unversioned library,
e.g., "ghci -lm" which would load the current version of the math
library into the GHC interpreter.)

Howard



More information about the Python-Dev mailing list