Skip to content

Commit 870d429

Browse files
authored
Rollup merge of #144092 - Gelbpunkt:musl-stage0, r=Kobzol
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 target, which is exposed in `sys.implementation._multiarch` and has values like "x86_64-linux-gnu" or "powerpc64le-linux-musl".
2 parents 17e2d69 + 9e4f777 commit 870d429

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)