Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python 3.11 is unbuildable with GCC on macOS (error: 'HAVE_MKFIFOAT_RUNTIME' undeclared, error: 'HAVE_MKNODAT_RUNTIME' undeclared) #104106

Closed
Labels
OS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error
@biergaizi

Description

@biergaizi

Bug report

Due to missing fallback macro definitions inModules/posixmodule.c (source) forHAVE_MKFIFOAT_RUNTIME andHAVE_MKNODAT_RUNTIME, Python 3.11 cannot be built with GCC on macOS, due to the following failures:

./Modules/posixmodule.c: In function 'parse_posix_spawn_flags':./Modules/posixmodule.c:186:64: warning: comparison between pointer and integer  186 |                                 (posix_spawn != NULL && setsid != NULL)      |                                                                ^~./Modules/posixmodule.c:6026:13: note: in expansion of macro 'HAVE_POSIX_SPAWN_SETSID_RUNTIME' 6026 |         if (HAVE_POSIX_SPAWN_SETSID_RUNTIME) {      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~./Modules/posixmodule.c: In function 'os_mkfifo_impl':./Modules/posixmodule.c:10690:17: error: 'HAVE_MKFIFOAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?10690 |             if (HAVE_MKFIFOAT_RUNTIME) {      |                 ^~~~~~~~~~~~~~~~~~~~~      |                 HAVE_MKDIRAT_RUNTIME./Modules/posixmodule.c:10690:17: note: each undeclared identifier is reported only once for each function it appears in./Modules/posixmodule.c: In function 'os_mknod_impl':./Modules/posixmodule.c:10759:17: error: 'HAVE_MKNODAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?10759 |             if (HAVE_MKNODAT_RUNTIME) {      |                 ^~~~~~~~~~~~~~~~~~~~      |                 HAVE_MKDIRAT_RUNTIME./Modules/posixmodule.c: In function 'probe_mkfifoat':arm64-apple-darwin22-gcc  -Wsign-compare -DNDEBUG     -O2 -pipe -fwrapv -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include -I/Users/gentoo/gentoo/tmp/usr/include/ncursesw   -DPy_BUILD_CORE_BUILTIN -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.o./Modules/posixmodule.c:15647:23: error: 'HAVE_MKFIFOAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?15647 | PROBE(probe_mkfifoat, HAVE_MKFIFOAT_RUNTIME)      |                       ^~~~~~~~~~~~~~~~~~~~~./Modules/posixmodule.c:15611:11: note: in definition of macro 'PROBE'15611 |       if (test) {        \      |           ^~~~./Modules/posixmodule.c: In function 'probe_mknodat':./Modules/posixmodule.c:15651:22: error: 'HAVE_MKNODAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?15651 | PROBE(probe_mknodat, HAVE_MKNODAT_RUNTIME)      |                      ^~~~~~~~~~~~~~~~~~~~./Modules/posixmodule.c:15611:11: note: in definition of macro 'PROBE'15611 |       if (test) {        \      |           ^~~~make: *** [Makefile:2695: Modules/posixmodule.o] Error 1make: *** Waiting for unfinished jobs....

InModules/posixmodule.c, Python conditionally defines a series of macros that indicate whether a system call is supported based on#ifdef checks. By default, the clang specific__builtin_available() compiler built-in function is used to check them. But if__builtin_available() is unavailable, a fallback is also provided.

For example, forHAVE_FSTATAT_RUNTIME, we have:

#ifdef HAVE_BUILTIN_AVAILABLE#  define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)// [...]#else /* Xcode 8 or earlier */   /* __builtin_available is not present in these compilers, but    * some of the symbols might be weak linked (10.10 SDK or later    * deploying on 10.9.    *    * Fall back to the older style of availability checking for    * symbols introduced in macOS 10.10.    */#  ifdef HAVE_FSTATAT#    define HAVE_FSTATAT_RUNTIME (fstatat != NULL)#  endif#endif

The fallback is important because it's not only used to support older Xcode or macOS, but it also provides fallback when GCC is used. The function__builtin_available() is clang-only and does not exist in GCC. In the past, this was handled by theelse portion of theifdef, so it worked on GCC as well. Unfortunately, whenHAVE_MKFIFOAT_RUNTIME andHAVE_MKDIRAT_RUNTIME have been added to the code, a fallback was never provided, thus, compiling Python 3.11 with GCC now fails due to undeclared macros.

Your environment

  • CPython versions tested on: Python 3.11.3
  • Operating system and architecture: macOS 13.2.1
  • GCC 12.2.0

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp