[Distutils] setup.py build_ext --rpath behaviour
floris.bruynooghe at gmail.com
Sat May 2 23:13:56 CEST 2009
On Thu, Apr 16, 2009 at 11:42:28AM +0100, Floris Bruynooghe wrote:
> Now when using the --rpath option to the build_ext command
> distutils.unixcompiler.UnixCCompiler.runtime_library_dir_option() will
> use some heuristics to figure out which option to pass to compiler to
> get the runpath in (i.e. "-R" or "-Wl,-R" etc). I'm going to argue
> that this needs to be extened pass in -Wl,--enable-new-dtags,-R if the
> GNU linker is used so that the newer and better RUNPATH gets put into
> the shared objects all the time. (I don't yet know how to detect the
> GNU linker but would like a consensus on the desired behaviour before
> looking into this).
The patch for this is attached to http://bugs.python.org/issue5900
Feel free to give feedback/criticism if you care about this.
> The second issue with build_ext --rpath is on AIX. Again some
> background on AIX shared objects, AIX is not SysV-like and uses the
> XCOFF binary format instead of ELF. Therefore they don't have a RPATH
> or RUNPATH, but they do have a think called LIBPATH which does
> something similar. The difference between XCOFF's LIBPATH and ELF's
> RUNPATH is that AIX's runtime linker does not have a default search
> path, hence the full search path needs to be encoded into the LIBPATH
> of the shared object.
> Now I would propose for build_ext --rpath to encode the LIBPATH when
> used on AIX since that is the correct thing to do IMHO.
I was kind of hoping someone would pick up on this and at least argue
about how it is not a good thing to try and convert an option for one
concept (RPATH/RUNPATH) onto another one that isn't quite the same
(LIBPATH). The side-effects are just not as clearly defined and open
Anyway, having given this some more tought I now think it's not a good
thing. Instead I'm going to make a patch that raises and exception if
the --rpath option is used on AIX as it's behaviour is undefined. If
a user does want -blibpath:/some/path to be passed on to the linker
they can still use LDFLAGS.
Other opinions would be appreciated.
 The linker will actually simply ignore it lurring the user into
false security. Only when -bsvr4 is passed to the linker too will
it be treated identical as -blibpath, but this is again the same
fuzzy mapping as a SysV user will not be used to passing in the
default search path to -R/--rpath and hence probably not end up
with what they wanted too.
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
More information about the Distutils-SIG