1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-09 20:13:47 -05:00

Fix wrong libpython being linked to in MacOS (#2596)

Without rpath, python would link up to the system's libpython
This commit is contained in:
native-api
2023-01-19 00:21:10 +03:00
committed by GitHub
parent bd618ea9ef
commit 819e2b8f45
4 changed files with 84 additions and 79 deletions

View File

@@ -1199,7 +1199,7 @@ require_gcc() {
export CC="$gcc"
if is_mac -ge 1010; then
export MACOSX_DEPLOYMENT_TARGET=10.9
export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-10.9}
fi
}
@@ -2208,8 +2208,8 @@ package_option python configure --libdir="${PREFIX_PATH}/lib"
# python-build: Set `RPATH` if `--enable-shared` was given (#65, #66, #82)
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS ${PYTHON_CONFIGURE_OPTS_ARRAY[@]}" == *"--enable-shared"* ]]; then
# The ld on Darwin embeds the full paths to each dylib by default
if [[ "$LDFLAGS" != *"-rpath="* ]] && ! is_mac; then
export LDFLAGS="-Wl,-rpath=${PREFIX_PATH}/lib${LDFLAGS:+ $LDFLAGS}"
if [[ "$LDFLAGS" != *"-rpath="* ]] ; then
export LDFLAGS="-Wl,-rpath,${PREFIX_PATH}/lib${LDFLAGS:+ $LDFLAGS}"
fi
fi