Description
macOS 13 Ventura adds support for the POSIX mkfifoat
and mknodat
system calls which are used in the Python os module via posixmodule.c when available on the OS. In order to continue to support building Python on a newer macOS version to also run on older systems, we need to add weaklinking support for them in posixmodule.c as was done for other similar system calls added in recent macOS releases.
Unfortunately, while macOS 13 has not yet been released as of this moment, Apple has pushed out a new version of the Command Line Tools for macOS 12 Monterey, Command Line Tools beta 3 for Xcode 14.1
, which changes the default macOS SDK version to MacOSX13.0. When building on macOS 12 with the macOS 13 SDK, posixmodule compiles support for mkfifoat
and mknodat
which will cause Python segfaults when attempting to use the dir_fd
option of os.mkfifo()
or os.mknod()
on macOS 12 (or older). An easily overlooked symptom of the problem is the following set of warning messages during compilation:
./Modules/posixmodule.c:10627:22: warning: 'mkfifoat' is only available on macOS 13.0 or newer [-Wunguarded-availability-new]
result = mkfifoat(dir_fd, path->narrow, mode);
^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stat.h:394:9: note: 'mkfifoat' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 12.6.0
int mkfifoat(int, const char *, mode_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0));
^
./Modules/posixmodule.c:10627:22: note: enclose 'mkfifoat' in a __builtin_available check to silence this warning
result = mkfifoat(dir_fd, path->narrow, mode);
^~~~~~~~
./Modules/posixmodule.c:10679:22: warning: 'mknodat' is only available on macOS 13.0 or newer [-Wunguarded-availability-new]
result = mknodat(dir_fd, path->narrow, mode, device);
^~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stat.h:395:9: note: 'mknodat' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 12.6.0
int mknodat(int, const char *, mode_t, dev_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0));
^
./Modules/posixmodule.c:10679:22: note: enclose 'mknodat' in a __builtin_available check to silence this warning
result = mknodat(dir_fd, path->narrow, mode, device);
^~~~~~~
One workaround is to force use of the macOS 12 SDK:
SDKROOT=$(xcrun --show-sdk-path --sdk macosx12.3) ./configure ...
Metadata
Metadata
Assignees
Labels
Projects
Status