STINNER Victor <vstin...@redhat.com> added the comment:
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 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36659> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com