[Distutils] Dynamic linking on Linux, Mac OS, et al
Phillip J. Eby
pje at telecommunity.com
Fri Jan 6 05:21:07 CET 2006
Hi folks. I just implemented preliminary shared library build support for
setuptools, but I ran into a bit of a snag. I was operating under the
assumption that you could simply put shared libraries in the directory
alongside the extensions that use them, but in practice it turns out that
this only works on Windows. On Linux I found that you could only put
shared libraries in a directory on LD_LIBRARY_PATH, and I suspect a similar
issue will be found under OS X and other Unixes.
This seems to be a bit of a problem, in that it appears to mean there's no
sane way to include shared libraries in an egg on any platform other than
Windows. It's common practice for Python extensions built for Windows to
include shared libraries to avoid having to install them in the Windows
system directories, but for Unix-like OSes this isn't really the normal
practice anyway.
But, in the case where a developer wants to include a shared library as
part of the distribution, this remains somewhat problematic. One can of
course install the library to a platform-appropriate location ($prefix/lib
on most platforms), but to do it from an egg is harder. You can't simply
unzip the egg any more, you would have to also move the libraries to a
standard installation location, breaking any hope of multi-version
support. (And this would have to be able to happen on the fly, when shared
libraries and extensions are extracted to the cache directory, if running
zipped.)
I don't suppose you can modify LD_LIBRARY_PATH on the fly? Any other
options? Should I just give up on supporting shared libraries on anything
but Windows, perhaps silently converting the shared libraries to static ones?
More information about the Distutils-SIG
mailing list