asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
651 stars 56 forks source link

Python build failed on MacOs Big Sur 11.2.1 #93

Closed diegoos closed 3 years ago

diegoos commented 3 years ago

Hi.

I'm getting an error when try to install python 3.6.0 (I've tried other versions like 3.9.0, 3.6.10, 3.7...).

$ asdf install python 3.6.0                                                        
python-build 3.6.0 /Users/diegoos/.asdf/installs/python/3.6.0
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.0.tar.xz...
-> https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
Installing Python-3.6.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 10.16 using python-build 1.2.23-16-gb4a5bb3d)

Inspect or clean up the working tree at /var/folders/qp/m_z367xx0lg6vggb75r7smn00000gp/T/python-build.20210224182046.88410
Results logged to /var/folders/qp/m_z367xx0lg6vggb75r7smn00000gp/T/python-build.20210224182046.88410.log

Last 10 log lines:
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/diegoos/.asdf/installs/python/3.6.0/include  -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/diegoos/.asdf/installs/python/3.6.0/include   -DPy_BUILD_CORE  -c ./Modules/errnomodule.c -o Modules/errnomodule.o
./Modules/posixmodule.c:8146:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = sendfile(in, out, offset, &sbytes, &sf, flags);
              ^
./Modules/posixmodule.c:10340:5: warning: code will never be executed [-Wunreachable-code]
    Py_FatalError("abort() called from Python code didn't abort!");
    ^~~~~~~~~~~~~
1 warning and 1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....

I'm using:

Until now I've tried to:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
brew reinstall zlib bzip2

export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
export ASDF_PYTHON_PATCH_URL="https://github.com/python/cpython/commit/8ea6353.patch?full_index=1"
asdf install python 3.6.0
brew reinstall zlib bzip2

export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
export ASDF_PYTHON_PATCH_URL="https://github.com/python/cpython/commit/8ea6353.patch?full_index=1"
asdf install python 3.6.0

Can someone help with any other alternative or way to fix this?

eltonscm commented 3 years ago

I had the same problem and this comment worked for me.

diegoos commented 3 years ago

Hi @eltonscm. Following the link, I managed to install version 3.6.0.

An important detail that I had not tried in the other alternatives that I followed was to update the openssl.

I already had all dependencies mentioned in the link you sent, but there was an error warning about the version of openssl.

Error: openssl@1.1 1.1.1h is already installed.
To upgrade to 1.1.1j, run:
  brew upgrade openssl@1.1

The brew upgrade openssl@1.1 updated more than 20 dependencies including python and readline.

Finally, it worked by running the commands from the link you sent. Thanks!

morenoh149 commented 3 years ago

here's the solution for asdf users on Big Sur

brew install bzip2 lbzip2 lzlib openssl zlib
LDFLAGS="-L/usr/local/opt/bzip2/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib" CFLAGS="-I/usr/local/opt/bzip2/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -I$(xcrun --show-sdk-path)/usr/include -Wno-implicit-function-declaration" asdf install python 3.6.13