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