[Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently

Albert-Jan Roskam fomcl at yahoo.com
Thu Jan 17 16:33:45 CET 2013



---- Original Message -----

> From: eryksun <eryksun at gmail.com>
> To: Albert-Jan Roskam <fomcl at yahoo.com>
> Cc: Python Mailing List <tutor at python.org>
> Sent: Thursday, January 17, 2013 3:21 PM
> Subject: Re: [Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently
> 
> On Wed, Jan 16, 2013 at 4:06 PM, Albert-Jan Roskam <fomcl at yahoo.com> 
> wrote:
>> 
>>  Is there a builtin function that can set LD_LIBRARY_PATH or equivalents
>>  platform-independently? It would be nice use such a function in a setup
>>  script.
> 
> Modifying LD_LIBRARY_PATH only affects child processes (ld.so caches
> the search path). In contrast, Windows evaluates the current PATH when
> searching for DLLs (other than SxS assemblies). What's the immediate
> goal here? For building an extension module with distutils you can use
> library_dirs and runtime_library_dirs (UNIX, embed an rpath)

Hi Eryksun,

The goal is to load the C libraries (dll, so, dylib, etc) that my program needs. Your suggestion about distutils seems very useful! I've also been checking distutils2, setuptools and distribute and I still wasn't sure which package to choose (distutils2.core doesn't seem to exist anymore, so I'll just try to use distutils).

Anyway, I looked up your two suggestions about library_dirs and runtime_library_dirs. What is meant by "at link time"? (it might be that I don't understand this because English is not my mother tongue). Given your explanation, the "runtime_library_dirs" does not seem to be an option.

Then your remark about rpath. Does this mean that the ELF header of the library itself is modified (I believe I read something about that on StackOverflow)? The libraries I am using are copyrighted (one can freely use them, but no reverse engineering, disentangling, etc). I am not sure whether adding an rpath will be copyright infringement. Logically, I'd say no, but I doubt whether logic applies in legal stuff. ;-)

   library_dirs : [string]
 |      list of directories to search for C/C++ libraries at link time
 |    libraries : [string]
 |      list of library names (not filenames or paths) to link against
 |    runtime_library_dirs : [string]
 |      list of directories to search for C/C++ libraries at run time
 |      (for shared extensions, this is when the extension is loaded)

Regards,
Albert-Jan


More information about the Tutor mailing list