Skip to content

Commit 9e4f777

Browse files
committed
bootstrap: Detect musl hosts
Currently, all non-Android Linux hosts are assumed to be using glibc. This obviously isn't very portable and will currently result in downloading a stage0 toolchain for glibc even on musl hosts. There are multiple ways to detect musl somewhat reliably, but the easiest option is to check for the python SOABI config variable, which has values like "cpython-313-x86_64-linux-gnu" or "cpython-313-powerpc64-linux-musl". Signed-off-by: Jens Reidel <[email protected]>
1 parent 9cd918b commit 9e4f777

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bootstrap/bootstrap.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import shutil
99
import subprocess
1010
import sys
11+
import sysconfig
1112
import tarfile
1213
import tempfile
1314

@@ -333,7 +334,11 @@ def default_build_triple(verbose):
333334
if ostype == "Android":
334335
kernel = "linux-android"
335336
else:
336-
kernel = "unknown-linux-gnu"
337+
python_soabi = sysconfig.get_config_var("SOABI")
338+
if python_soabi is not None and "musl" in python_soabi:
339+
kernel = "unknown-linux-musl"
340+
else:
341+
kernel = "unknown-linux-gnu"
337342
elif kernel == "SunOS":
338343
kernel = "pc-solaris"
339344
# On Solaris, uname -m will return a machine classification instead

0 commit comments

Comments
 (0)