Modules failing to add runtime library path info at link time

C

cjblaine

Hey everyone, this has been driving me crazy for long enough now that
I'm motivated to post and find an answer.

Before I pose my question, let me state that using LD_LIBRARY_PATH is
not the answer :)

We have things installed in odd places, such as very specific versions
of libraries to link against, etc.

When I build a module (let's say PyGreSQL for instance) via python
setup.py build, the link part is including a proper -L argument (-L/
some/weird/lib because /some/weird/bin was in PATH), but is omitting
the additional needed runtime linker arguments.

For Solaris that's -R/some/weird/lib

For Linux that's -Xlinker -rpath -Xlinker /some/weird/lib

Where/how can I configure the appropriate portion of our Python
install to do 100% the right thing instead of just 50% (-L)?

A specific example -- note the -L and lack of -R (Solaris build):

% python setup.py build
....
gcc -shared build/temp.solaris-2.10-sun4u-2.6/pgmodule.o -L/afs/rcf/
apps/catchall/lib -lpq -o build/lib.solaris-2.10-sun4u-2.6/_pg.so
%
 
C

cjblaine

Python's distutils doesn't alter the library search path unless you tell
it explicitly.



The Extension() class supports the rpath argument. Simply add
rpath="/path/to/library/dir" and you are good.

Christian

Thanks for the reply.

So, python setup.py build rpath="/whatever/lib" ?
 
C

cjblaine

Thanks for the reply.

So, python setup.py build rpath="/whatever/lib" ?

Replying to myself:

No. Actually, Christian, it looks like it's runtime_library_dirs?

class Extension:
....
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)

So, how does one inject that into, I assume, setup.cfg ? Ideally it
could be done via the build command-line, but I don't see a way to do
that when browsing python setup.py build --help

( there is no setup.cfg provided in the PyGreSQL source tree, to )
( continue that example case )
 
C

cjblaine

Thanks for the reply.
So, python setup.py build rpath="/whatever/lib" ?

Replying to myself:

No.  Actually, Christian, it looks like it's runtime_library_dirs?

class Extension:
...
      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)

So, how does one inject that into, I assume, setup.cfg ?  Ideally it
could be done via the build command-line, but I don't see a way to do
that when browsing python setup.py build --help

( there is no setup.cfg provided in the PyGreSQL source tree, to )
( continue that example case                                     )

Anyone?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top