This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients cstratak, fweimer, koobs, vstinner
Date 2019-04-23.15:02:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556031764.42.0.296078449901.issue36659@roundup.psfhosted.org>
In-reply-to
Content
I'm confused between RPATH and RUNPATH which are *different*.

When I configure Python using LDFLAGS="-Wl,-rpath=/opt/py38/lib/" (Python configure and Makefile), Python, libpython, and dynamic libraries ELF of C extensions get a RPATH.

When I use setup.py build_ext -rpath (distutils), dynamic libraries ELF of C extensions get a RUNPATH.

More details below.

--

When I build lxml using patched Fedora Python (/usr/bin/python3), I get:

$ python3 setup.py build_ext --rpath /custom/rpath
...
$ objdump -a -x build/lib.linux-x86_64-3.7/lxml/etree.cpython-37m-x86_64-linux-gnu.so|grep -Ei 'rpath|runpath'
  RUNPATH              /custom/rpath

Note: when I use patched Fedora Python, "--rpath /usr/lib64" of "python3 setup.py build_ext --rpath /usr/lib64" is ignored: the .so file doesn't have RPATH nor RUNPATH. That's the purpose of the patch.

--

When I built Python using ./configure --prefix /opt/py38 LDFLAGS="-Wl,-rpath=/opt/py38/lib/" --enable-shared, I got:

$ objdump -a -x /opt/py38/bin/python3.8|grep -i rpath
  RPATH                /opt/py38/lib/
$ objdump -a -x /opt/py38/lib/libpython3.8m.so|grep -i rpath
  RPATH                /opt/py38/lib/

If I build lxml without an explicit rpath, it inherits the Python rpath:

$ LD_LIBRARY_PATH=/opt/py38/lib ./opt_env/bin/python setup.py build_ext 
$ objdump -a -x build/lib.linux-x86_64-3.8/lxml/etree.cpython-38m-x86_64-linux-gnu.so|grep -Ei 'rpath|runpath'
  RPATH                /opt/py38/lib/

If I build lxml with an explicit rpath, I get:

$ LD_LIBRARY_PATH=/opt/py38/lib ./opt_env/bin/python setup.py build_ext --rpath /custom/rpath
$ objdump -a -x build/lib.linux-x86_64-3.8/lxml/etree.cpython-38m-x86_64-linux-gnu.so|grep -Ei 'rpath|runpath'
  RUNPATH              /opt/py38/lib/:/custom/rpath
History
Date User Action Args
2019-04-23 15:02:44vstinnersetrecipients: + vstinner, koobs, fweimer, cstratak
2019-04-23 15:02:44vstinnersetmessageid: <1556031764.42.0.296078449901.issue36659@roundup.psfhosted.org>
2019-04-23 15:02:44vstinnerlinkissue36659 messages
2019-04-23 15:02:44vstinnercreate