Add LDFLAGS for zlib on macOS >= 1100#1711
Conversation
Add LDFLAGS for Xcode SDK zlib on macOS >= 1100 to resolve build issues on Big Sur.
|
Now that Big Sur is available for realz, it would be great to have this in pyenv :-) |
|
Hello all, |
Installing Python via pyenv on Big Sur for older Python versions requires: * Setting LDFLAGS for zlib (pyenv/pyenv#1711) * Patching the source code Once a new release of pyenv is released and we use a newer Python 3 version we will not need all these hacks and all Mac versions will be able to use the same code paths. Fixes #22497
|
@joshfriend This PR may actually cause the build to fail compiling readline from home-brew. At least on both of my macs running on macOS Big Sur 11.0.1. It will print WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?The error could not have been caught by travis-ci because the pipeline does not include macOS 11 (yet). This time, pyenv installed/compiled python with no errors or warnings. So, it turns out that |
|
So I did some more digging and apparently the order in LDFLAGS is somehow relevant (?) if is_mac -ge 1100; then
export LDFLAGS="-L${xc_sdk_path}/usr/lib ${LDFLAGS}"
fi--> Warning ... if is_mac -ge 1100; then
export LDFLAGS="${LDFLAGS} -L${xc_sdk_path}/usr/lib"
fi--> no warning |
|
Edit: I updated the travis setup and the python-build-script to force travis to build against macOS SDK 11.0 (osx_image xcode12.2) and was able to reproduce the warning that readline extension was not compiled. However, this is not treated as a build error and hence the checks passed. But you can see the warning in the travis-logs. See example here: https://github.com/tillhainbach/pyenv/pull/8 and logs here https://travis-ci.com/github/tillhainbach/pyenv/jobs/457193096#L9265 So, it should be considered merging #1754 |
Installing Python via pyenv on Big Sur for older Python versions requires: * Setting LDFLAGS for zlib (pyenv/pyenv#1711) * Patching the source code Once a new release of pyenv is released and we use a newer Python 3 version we will not need all these hacks and all Mac versions will be able to use the same code paths. Fixes #22497
Installing Python via pyenv on Big Sur for older Python versions requires: * Setting LDFLAGS for zlib (pyenv/pyenv#1711) * Patching the source code Once a new release of pyenv is released and we use a newer Python 3 version we will not need all these hacks and all Mac versions will be able to use the same code paths. Fixes #22497
|
@tillhainbach did you consider any other methods than adding a linker flag? It seems homebrew are using -isysroot for this stuff instead, I'n not sure whether that should make much difference. |
Add LDFLAGS for Xcode SDK zlib on macOS >= 1100 to resolve build issues on Big Sur.
Make sure you have checked all steps below.
Prerequisite
n/a
n/a - this code does not appear in rbenv
Note: The issue is for general macOS 11 Big Sur beta build issues. Users must also have downloaded the Xcode 12.2 beta from Apple and have the macOS 11 SDK installed in addition to the Big Sur beta itself.
Description
This is a 3 line change to python-build that affects macOS 11.0 Big Sur (currently in beta). Big Sur no longer packages dynamic libraries in /usr/lib as detailed in Unable to build Python on macOS Big Sur with Xcode 12 beta #1643 (comment) . This requires python-build to link against $(xcrun --show-sdk-path)/usr/lib on macOS >= 11.0 when using the macOS-shipped zlib. This allows python-build to correctly build python again on macOS 11 (Big Sur).
Tests
n/a