[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

STINNER Victor report at bugs.python.org
Tue Apr 23 11:26:25 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

To come back to RPATH vs RUNPATH: these 2 are very different in term of priorities in search (see other comments).

distutils uses an heuristic to opt-in for RUNPATH using GNU ld --enable-new-dtags option. This option is only used if the following 3 conditions are met:

(1) the OS is not macOS, not FreeBSD, nor HP-UX
(2) the C compiler is detected as GCC
(3) Python detected the linker as being GNU ld

Problem: the heuristic is not very reliable:

(3) only checks the linker when Python is build, it's implemented as: sysconfig.get_config_var("GNULD") == "yes". In practice, the linker can be changed at runtime using environment variables and so Python may miss the oportunity for opt-in for --enable-new-dtags, or pass this option which is unknown to another linker.

(2) The detection of GCC checks for "gcc" or "g++" string if the name of the compiler program name. If you use "cc", it's not detected as GCC.

I'm not sure that these 2 problems are real problems "in practice".

My main concern is that you might get RPATH or RUNPATH depending on operating system, the C compiler and the linker, whereas RPATH semantics is very different from RUNPATH semantics (search priority).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36659>
_______________________________________


More information about the Python-bugs-list mailing list