Skip to content

Commit 4a36797

Browse files
authored
Apply readelf patch for cross-compiling on older Python versions (astral-sh#452)
Linux cross-compiles are failing on `main` @ astral-sh@01cfc3b due to `readelf` missing. We drop this check as part of the Apple cross compilation patch but since astral-sh#443 we no longer apply that patch on Linux. This moves the patch out into a separate file and applies it when cross-compiling on Python <=3.12 where it is relevant.
1 parent 01cfc3b commit 4a36797

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

Diff for: cpython-unix/build-cpython.sh

+7
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
8080
fi
8181
fi
8282

83+
# disable readelf check when cross-compiling on older Python versions
84+
if [ -n "${CROSS_COMPILING}" ]; then
85+
if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_11}" ]; then
86+
patch -p1 -i ${ROOT}/patch-cross-readelf.patch
87+
fi
88+
fi
89+
8390
# This patch is slightly different on Python 3.10+.
8491
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_10}" ]; then
8592
patch -p1 -i ${ROOT}/patch-xopen-source-ios.patch

Diff for: cpython-unix/patch-apple-cross.patch

-16
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,6 @@ index c62a565eb6..7e5d34632c 100644
7171
LDLIBRARY='libpython$(LDVERSION).dylib'
7272
BLDLIBRARY='-L. -lpython$(LDVERSION)'
7373
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
74-
@@ -1626,15 +1665,6 @@ then
75-
fi
76-
77-
AC_CHECK_TOOLS([READELF], [readelf], [:])
78-
-if test "$cross_compiling" = yes; then
79-
- case "$READELF" in
80-
- readelf|:)
81-
- AC_MSG_ERROR([readelf for the host is required for cross builds])
82-
- ;;
83-
- esac
84-
-fi
85-
-AC_SUBST(READELF)
86-
-
87-
88-
case $MACHDEP in
89-
hp*|HP*)
9074
@@ -3173,6 +3203,11 @@ then
9175
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
9276
LDSHARED='$(CC) -shared'

Diff for: cpython-unix/patch-cross-readelf.patch

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/configure.ac b/configure.ac
2+
index c62a565eb6..7e5d34632c 100644
3+
--- a/configure.ac
4+
+++ b/configure.ac
5+
@@ -1626,15 +1665,6 @@ then
6+
fi
7+
8+
AC_CHECK_TOOLS([READELF], [readelf], [:])
9+
-if test "$cross_compiling" = yes; then
10+
- case "$READELF" in
11+
- readelf|:)
12+
- AC_MSG_ERROR([readelf for the host is required for cross builds])
13+
- ;;
14+
- esac
15+
-fi
16+
-AC_SUBST(READELF)
17+
-
18+
19+
case $MACHDEP in
20+
hp*|HP*)

0 commit comments

Comments
 (0)