Skip to content

Commit 10218de

Browse files
authored
Specifically use DT_RPATH instead of DT_RUNPATH for the libpython hack (#623)
We need this to get inherited to dependent libraries, i.e., to extension modules.
1 parent d786b16 commit 10218de

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cpython-unix/build-cpython.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,11 @@ if [ "${PYBUILD_SHARED}" = "1" ]; then
756756
# empty dummy libpython.so, which allows the link to succeed but
757757
# ensures they do not use any unwanted symbols. That might be
758758
# worth doing at some point.)
759-
patchelf --set-rpath "\$ORIGIN/../lib" \
759+
patchelf --force-rpath --set-rpath "\$ORIGIN/../lib" \
760760
${ROOT}/out/python/install/bin/python${PYTHON_MAJMIN_VERSION}
761761

762762
if [ -n "${PYTHON_BINARY_SUFFIX}" ]; then
763-
patchelf --set-rpath "\$ORIGIN/../lib" \
763+
patchelf --force-rpath --set-rpath "\$ORIGIN/../lib" \
764764
${ROOT}/out/python/install/bin/python${PYTHON_MAJMIN_VERSION}${PYTHON_BINARY_SUFFIX}
765765
fi
766766

@@ -777,7 +777,8 @@ if [ "${PYBUILD_SHARED}" = "1" ]; then
777777
# cases, we have no concerns/need no workarounds for code
778778
# referencing libpython3.x.so.1.0, because we are actually
779779
# dynamically linking it and so all code will get the real
780-
# libpython3.x.so.1.0 that they want.
780+
# libpython3.x.so.1.0 that they want (and it's fine to use
781+
# DT_RUNPATH instead of DT_RPATH).
781782
if [ "${CC}" == "musl-clang" ]; then
782783
# libpython3.so isn't present in debug builds.
783784
if [ -z "${CPYTHON_DEBUG}" ]; then

0 commit comments

Comments
 (0)