[Distutils] static linking in distutils/setuptools?

Matthias Urlichs smurf at smurf.noris.de
Thu Jan 26 23:02:12 CET 2006


Robert Kern:
> Not really, no. In many cases (e.g., GNU ld), there's simply no way to
> tell the linker that you prefer static libraries to shared libraries
> when you are building a shared library like a Python extension. You
> simply have to make sure that the static libraries are found first.
Note: Linking static code (gcc without -fpic => foo.o => libfoo.a) into
a shared library (lib*.so) is a bad idea. On i386, the required
relocation means that the static library's text is not shared between
concurrent invocations, and loading the library is more expensive too.
On some other architectures, either linking the library, or loading it,
will simply fail.

You need to build an archive of shared objects (same as above, but use
-fpic or equivalent). These are usually named lib*_pic.a IIRC.

Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf at smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
It is surely a great calamity for a human being to have no obsessions.
		-- Robert Bly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20060126/a37ba568/attachment-0001.pgp 

More information about the Distutils-SIG mailing list