Skip to content

Commit a6964aa

Browse files
committed
unix: force cross_compiling=yes when we are cross-compiling
See the inline comment for more. Impetus for this is x86-64 microarchitecture level targeting, which would enable cross-compiles for the `x86-64-unknown-linux-gnu` triple.
1 parent 8c6a024 commit a6964aa

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,35 @@ cat Makefile.extra
161161

162162
pushd Python-${PYTHON_VERSION}
163163

164+
# configure assumes cross compiling when host != target and doesn't provide a way to
165+
# override. Our target triple normalization may lead configure into thinking we
166+
# aren't cross-compiling when we are. So force a static "yes" value when our
167+
# build system says we are cross-compiling.
168+
if [ -n "${CROSS_COMPILING}" ]; then
169+
patch -p1 <<"EOF"
170+
diff --git a/configure b/configure
171+
index d078887b2f..8f1ea07cd8 100755
172+
--- a/configure
173+
+++ b/configure
174+
@@ -1329,14 +1329,7 @@ build=$build_alias
175+
host=$host_alias
176+
target=$target_alias
177+
178+
-# FIXME: To remove some day.
179+
-if test "x$host_alias" != x; then
180+
- if test "x$build_alias" = x; then
181+
- cross_compiling=maybe
182+
- elif test "x$build_alias" != "x$host_alias"; then
183+
- cross_compiling=yes
184+
- fi
185+
-fi
186+
+cross_compiling=yes
187+
188+
ac_tool_prefix=
189+
test -n "$host_alias" && ac_tool_prefix=$host_alias-
190+
EOF
191+
fi
192+
164193
# configure doesn't support cross-compiling on Apple. Teach it.
165194
patch -p1 << "EOF"
166195
diff --git a/configure b/configure

0 commit comments

Comments
 (0)