[Distutils] Dynamic linking on Linux, Mac OS, et al

Jim Fulton jim at zope.com
Sat Jan 14 22:01:44 CET 2006


Phillip J. Eby wrote:
> At 10:06 AM 1/14/2006 -0500, Jim Fulton wrote:
> 
>> On many Linux (Unix?) platforms, you can pass an -rpath/-R option to the
>> linker at build time that causes the run-time linker to use specific
>> paths to load libraries.  This feature is supported by disutils through
>> its --rpath/-R build_ext options.
> 
> 
> But that's not relocatable (to different directories), and eggs are 
> intended to be "zero-install" for simple use cases.  So, the solution I 
> came up with uses '.' in the rpath, and a stub loader that changes 
> directories

Changes directories? Uh ... this sounds brittle.

 > long enough to get the extension to load and find its
> library (or libraries).  This appears to work decently enough on Linux.
> 
> 
>> BTW, I often have need to be able to create what we call "application
>> buildouts" that contain various facilities needed by a particular
>> application.  These facilities are mostly Python-based but often include
>> things like relational databases, ICU, ldap servers, etc.  We want
>> to be able to have buildouts for multiple applications (or multiple
>> application versions) on a single development machine.  Each buildout
>> needs to be able to control versions of things it uses (including
>> Python versions).  We try to minimize the dependence on system libraries,
>> as these are usually different on development and deployment systems
>> and because we may need different versions for different applications on
>> a development machine.  I'm just beginning to learn about eggs.
>> I certainly hope I'll have the same flexibility when installing eggs
>> that I have now when using distutils.
> 
> 
> I'm not sure I can answer that question, or that I even know what your 
> question is, actually.  :)  Eggs don't really try to encompass building 
> arbitrary executables, only Python code, C/C++/Pyrex/SWIG extensions, 
> and libraries linked to the extensions.  It sort of sounds like you're 
> saying you'd like to be able to build a bunch of non-Python stuff too, 
> which is likely to remain out of scope for the foreseeable future.

No.  I want to be able to get a Python egg built in such a way that
it uses a library in a location I tell it to, rather than in the standard
system libraries.  For example, suppose I have an egg with an extension that
uses ICU, and that I've installed the ICU libraries in a non-standard place.
When I build the egg, I want to tell it to use the location that I specify
for ICU. I can do this with setup now with the -R option to build_ext.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Distutils-SIG mailing list