Skip to content

Commit 1e4f692

Browse files
committed
Specifically use DT_RPATH instead of DT_RUNPATH for the libpython hack
We need this to get inherited to dependent libraries, i.e., to extension modules.
1 parent 482a9bc commit 1e4f692

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
@@ -753,11 +753,11 @@ if [ "${PYBUILD_SHARED}" = "1" ]; then
753753
# empty dummy libpython.so, which allows the link to succeed but
754754
# ensures they do not use any unwanted symbols. That might be
755755
# worth doing at some point.)
756-
patchelf --set-rpath "\$ORIGIN/../lib" \
756+
patchelf --force-rpath --set-rpath "\$ORIGIN/../lib" \
757757
${ROOT}/out/python/install/bin/python${PYTHON_MAJMIN_VERSION}
758758

759759
if [ -n "${PYTHON_BINARY_SUFFIX}" ]; then
760-
patchelf --set-rpath "\$ORIGIN/../lib" \
760+
patchelf --force-rpath --set-rpath "\$ORIGIN/../lib" \
761761
${ROOT}/out/python/install/bin/python${PYTHON_MAJMIN_VERSION}${PYTHON_BINARY_SUFFIX}
762762
fi
763763

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

0 commit comments

Comments
 (0)