DEV Community

Hiro Takkii
Hiro Takkii

Posted on

pyenv install 3.8.2 BUILD FAILED (OS X 11.5.2 using python-build 20180424)

Introduction

Following command failed.

❯ pyenv install 3.8.2
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.8.2...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.5.2 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/96/vjhghky10417fblgh4m1ltcw0000gn/T/python-build.20220212200129.83880
Results logged to /var/folders/96/vjhghky10417fblgh4m1ltcw0000gn/T/python-build.20220212200129.83880.log

Last 10 log lines:
                                                     ^
clang -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/hiro_takkii/.pyenv/versions/3.8.2/include -I/usr/local/opt/zlib/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/hiro_takkii/.pyenv/versions/3.8.2/include -I/usr/local/opt/zlib/include  -DPy_BUILD_CORE -o Modules/gcmodule.o Modules/gcmodule.c
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/hiro_takkii/.pyenv/versions/3.8.2/include -I/usr/local/opt/zlib/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/hiro_takkii/.pyenv/versions/3.8.2/include -I/usr/local/opt/zlib/include  -DPy_BUILD_CORE_BUILTIN  -DPy_BUILD_CORE_BUILTIN -I./Include/internal -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c:9197:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = sendfile(in, out, offset, &sbytes, &sf, flags);
              ^
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
Enter fullscreen mode Exit fullscreen mode

Solution

You can install with patch-flag.

> Install with the --patch flag
pyenv install --patch 3.8.2 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch)

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.8.2...
patching file Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
patching file configure
Hunk #1 succeeded at 3394 (offset -32 lines).
patching file configure.ac
Hunk #1 succeeded at 498 (offset -12 lines).
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

Installed Python-3.8.2 to /Users/hiro_takkii/.pyenv/versions/3.8.2
Enter fullscreen mode Exit fullscreen mode

Thanks.

Reference

Unable to build Python on macOS Big Sur with Xcode 12 beta

Oldest comments (0)