Skip to content

Commit

Permalink
dev-lang/python-3.11.3: fix build on macOS.
Browse files Browse the repository at this point in the history
Currently, dev-lang/python-3.11.3 is unbuildable on macOS due to GCC
incompatibility. There exists two "#ifdef" checks for the system calls
mkfifoat() and mknodat(), which are not compatible with GCC. Because
they're defined using the __builtin_available() function - specific to
clang without a fallback for GCC, they're never defined, thus creating
the following errors:

    ./Modules/posixmodule.c:15647:23: error: 'HAVE_MKFIFOAT_RUNTIME'
    undeclared (first use in this function); did you mean
    'HAVE_MKDIRAT_RUNTIME'?
    ./Modules/posixmodule.c:15651:22: error: 'HAVE_MKNODAT_RUNTIME'
    undeclared (first use in this function); did you mean
    'HAVE_MKDIRAT_RUNTIME'?

This bug [1] has already been reported to upstream with a patch [2]
waiting to be merged. This commit applies the upstream patch to add
the missing GCC fallbacks.

[1] python/cpython#104106
[2] python/cpython#104129

Closes: https://bugs.gentoo.org/905618
Signed-off-by: Yifeng Li <tomli@tomli.me>
  • Loading branch information
biergaizi committed May 5, 2023
1 parent 71d0e1d commit 1e5fa9b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
https://bugs.gentoo.org/905618
https://github.com/python/cpython/issues/104106
https://github.com/python/cpython/pull/104129

From 6fc35af351b61e795c8ef6e10ff0f22a71130542 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Wed, 3 May 2023 20:35:42 +0900
Subject: [PATCH 1/2] gh-104106: Add gcc fallback of mkfifoat/mknodat for macOS

---
Modules/posixmodule.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index dcb5e7a0e040..b395c265c72d 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -175,6 +175,14 @@
# define HAVE_PWRITEV_RUNTIME (pwritev != NULL)
# endif

+# ifdef HAVE_MKFIFOAT
+# define HAVE_MKFIFOAT_RUNTIME (mkfifoat != NULL)
+# endif
+
+# ifdef HAVE_MKNODAT
+# define HAVE_MKNODAT_RUNTIME (mknodat != NULL)
+# endif
+
#endif

#ifdef HAVE_FUTIMESAT
4 changes: 3 additions & 1 deletion dev-lang/python/python-3.11.3.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RDEPEND="
>=dev-libs/expat-2.1:=
dev-libs/libffi:=
dev-python/gentoo-common
sys-apps/util-linux:=
kernel_linux? ( sys-apps/util-linux:= )
>=sys-libs/zlib-1.1.3:=
virtual/libcrypt:=
virtual/libintl
Expand Down Expand Up @@ -127,6 +127,8 @@ src_prepare() {
"${WORKDIR}/${PATCHSET}"
# Prefix' round of patches
"${WORKDIR}"/${PREFIX_PATCHSET}

"${FILESDIR}"/${PN}-3.11.3-gcc-fallbacks-for-mkfifo-mknod-checks.patch
)

default
Expand Down

0 comments on commit 1e5fa9b

Please sign in to comment.