Python-2.2.1, Solaris7, make test fails...

Martin v. Loewis martin at v.loewis.de
Wed Apr 17 03:26:11 EDT 2002


"P. Alejandro Lopez-Valencia" <dradul at yahoo.com> writes:

> And while you are at it... You have not compiled python itself as PIC
> code. No, gcc -shared *doesn't* work in Solaris unless you are using GNU
> Binutils instead of the native linker and assembler, something *not
> recommended at all*. 

Can you elaborate? gcc -shared works fine on Solaris, and binutils
also works without problems.

> Solaris' linker can't bild a dynamic loading library/module using
> object code compiled in position dependent mode.

And rightly so. That should never be a problem, though.

Actually, you *can* talk the Solaris linker to incorporate non-PIC
text into a shared library. For that, it will make the text segment
writable. The -mimpure-text option of gcc triggers that feature.

> This means, that you need to have all external libraries compiled with
> the -fPIC flag, even if they are static. 

If you link static libraries into Python, I recommend to make the
modules that use them also static. Then you don't need PIC code for
those.

> Ahh! And make sure that you give the linker the actual library paths
> you use with an -R flag, else the dynamic loader won't find them and
> you'll have to use an explicit LD_LIBRARY_PATH environment variable
> for each invocation invocation of the internpreter.

That is the prime reason why I dislike shared libraries in the first
place - statically linked binaries are much easier to manage; use of
shared libraries should be restricted to system libraries, IMO.

Regards,
Martin



More information about the Python-list mailing list