1

I'm trying to build CPython from its 3.9 branch on a MacOS machine, but I'm getting the following errors when I run make -j2 -s:

./Modules/posixmodule.c:7192:9: error: implicit declaration of function 'openpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
        ^
./Modules/posixmodule.c:7192:9: note: did you mean 'openat'?
/usr/include/sys/fcntl.h:516:5: note: 'openat' declared here
int     openat(int, const char *, int, ...) __DARWIN_NOCANCEL(openat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
        ^
./Modules/posixmodule.c:7192:9: warning: this function declaration is not a prototype [-Wstrict-prototypes]
    if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
        ^
./Modules/posixmodule.c:7293:11: error: implicit declaration of function 'forkpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pid = forkpty(&master_fd, NULL, NULL, NULL);
          ^
./Modules/posixmodule.c:7293:11: warning: this function declaration is not a prototype [-Wstrict-prototypes]
2 warnings and 2 errors generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....

My Makefile was generated by running the following command:

CPPFLAGS="-I$(brew --prefix zlib)/include" \
LDFLAGS="-L$(brew --prefix zlib)/lib" \
./configure --with-openssl=$(brew --prefix openssl) \
--with-pydebug

Do you have any idea of what could be wrong or missing?

Update: Apparently, this is a known and unresolved issue. https://github.com/python/cpython/issues/78208

1 Answer 1

2

I've been plagued by this problem on a few different systems. In any case, I tried again, and found this GitHub issues thread for pyenv which had a lot of suggestions. In the end, this worked for me:

SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk pyenv install 3.10.0

Since this original question was not about pyenv I gave it a try separately. I was able to get through make but not make test and, unfortunately, I don't have time to sleuth it all out, but maybe this will help someone anyway.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.