Skip to content

Commit f073cef

Browse files
committed
Fix bad -pthread default when cross-compiling
See astral-sh#599.
1 parent 2af08c0 commit f073cef

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ else
306306
patch -p1 -i "${ROOT}/patch-python-configure-add-enable-static-libpython-for-interpreter-${PYTHON_MAJMIN_VERSION}.patch"
307307
fi
308308

309+
# When cross-compiling, ./configure checks that run code cannot be run,
310+
# and some of the defaults are wrong or unwanted, so we have to fix
311+
# those manually.
312+
# TODO(geofft): This cannot be the only thing.
313+
patch -p1 -i "${ROOT}/patch-python-configure-cross-assume-pthread.patch"
314+
309315
# We patched configure.ac above. Reflect those changes.
310316
autoconf
311317

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From c2bea55e3a2a31fc490d1a79c1dd2e413333148b Mon Sep 17 00:00:00 2001
2+
From: Geoffrey Thomas <[email protected]>
3+
Date: Tue, 6 May 2025 15:47:47 -0400
4+
Subject: [PATCH 1/1] configure.ac: When cross-compiling, assume -pthread works
5+
(astral-sh/python-build-standalone#599)
6+
7+
---
8+
configure.ac | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/configure.ac b/configure.ac
12+
index a3a5ac1cdce..3134ca2c974 100644
13+
--- a/configure.ac
14+
+++ b/configure.ac
15+
@@ -2927,7 +2927,7 @@ int main(void){
16+
(void)pthread_detach(p);
17+
return 0;
18+
}
19+
-]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
20+
+]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=yes])
21+
CC="$ac_save_cc"])
22+
fi
23+
24+
--
25+
2.39.5 (Apple Git-154)
26+

0 commit comments

Comments
 (0)