23

When I run

pyenv install 3.8.0

This is my command line errors:

jazab@Jazabs-MacBook-Pro ~ % pyenv install 3.8.0
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/1z/s1vxbsqs503drc76hq8njghr0000gn/T/python-build.20201224183625.52487
Results logged to /var/folders/1z/s1vxbsqs503drc76hq8njghr0000gn/T/python-build.20201224183625.52487.log

Last 10 log lines:
                                                     ^
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -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 -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/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include  -DPy_BUILD_CORE_BUILTIN  -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -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 -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/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include  -DPy_BUILD_CORE_BUILTIN  -c ./Modules/_sre.c -o Modules/_sre.o
./Modules/posixmodule.c:9084: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.
Oded BD
  • 2,788
  • 27
  • 30
Jazab C.
  • 255
  • 2
  • 5
  • 4
    CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.0 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1) – Zhong Ri Feb 23 '21 at 00:20
  • 1
    Try this one https://github.com/pyenv/pyenv/issues/1740#issuecomment-738749988 – Most Wanted Mar 05 '21 at 13:32
  • Thanks @smartworld-dm, this helped solve my issue. I think you should post this as an answer – tax evader Mar 29 '21 at 17:52
  • The problem are related here https://github.com/pyenv/pyenv/issues/1740 – Bruno Wego Apr 18 '21 at 02:03
  • 20
    Try this: `pyenv install 3.8.0 --patch < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch)` – Bruno Wego Apr 18 '21 at 02:15
  • CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" \ pyenv install --patch 3.7.3 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1) ----> change the version as you wish – Thomas John Apr 20 '21 at 10:33
  • Part of the confusion in the multiple tickets in the `pyenv` GitHub repo is that what works also depends on which libraries you have previously installed in Homebrew. The proper fix would be for Homebrew to sort this out in their `pyenv` package; there seems to be a recent update to that so maybe they have now. – tripleee Apr 29 '21 at 07:46
  • For what it's worth, there is absolutely no reason to backslash the equals sign in `full_index=1`. Newer versions after sometime midway in the 3.8.x series do not require the patch. – tripleee Apr 29 '21 at 07:49
  • The patch method mentioned by Bruno works for me and I am on Big Sur 11.3.1 and Xcode 12.5 – infinity_coding7 May 19 '21 at 04:25

0 Answers0