Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.
Prerequisite
Description
Python Autoconf scripts can fail on M1 Macs but not Intel Macs and it appears to be related to gettext being installed by Homebrew in the /opt/homebrew directory instead of /opt/local.
Interestingly, commenting out these lines from the use_homebrew method in python-build appears to resolve the issue.
This works on an Intel Mac:
pyenv install 3.10.3
pyenv shell 3.10.3
cat > test.c <<EOF
#include <Python.h>
int main() {
Py_Initialize();
}
EOF
gcc test.c $(python-config --cflags --ldflags --embed)
The result on an M1 Mac:
ld: library not found for -lintl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This works on an M1 Mac:
gcc test.c -L/opt/homebrew/opt/gettext/lib $(python-config --cflags --ldflags --embed)
This works on an M1 Mac after commenting out use_homebrew (lines 1328-1335 in /opt/homebrew/Cellar/pyenv/2.3.1/plugins/python-build/bin/python-build):
pyenv install 3.10.3
gcc test.c $(python-config --cflags --ldflags --embed)
Without use_homebrew:
otool -L ~/.pyenv/versions/3.10.3/bin/python
/Users/dave/.pyenv/versions/3.10.3/bin/python:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
With use_homebrew:
otool -L ~/.pyenv/versions/3.10.3/bin/python
/Users/dave/.pyenv/versions/3.10.3/bin/python:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
/opt/homebrew/opt/gettext/lib/libintl.8.dylib (compatibility version 11.0.0, current version 11.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.
Prerequisite
pyenvand the defaultpython-buildplugin only. Please refrain from reporting issues of other plugins here.Description
env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.logand attachtrace.log. E.g. if you have a problem with installing Python, runenv PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log(note the-voption topyenv install).Python Autoconf scripts can fail on M1 Macs but not Intel Macs and it appears to be related to
gettextbeing installed by Homebrew in the/opt/homebrewdirectory instead of/opt/local.Interestingly, commenting out these lines from the
use_homebrewmethod inpython-buildappears to resolve the issue.This works on an Intel Mac:
The result on an M1 Mac:
This works on an M1 Mac:
This works on an M1 Mac after commenting out
use_homebrew(lines 1328-1335 in/opt/homebrew/Cellar/pyenv/2.3.1/plugins/python-build/bin/python-build):Without
use_homebrew:With
use_homebrew: