Skip to content

Commit 2e99b18

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 target, which is exposed in sys.implementation._multiarch and has values like "x86_64-linux-gnu" or "powerpc64le-linux-musl". Signed-off-by: Jens Reidel <[email protected]>
1 parent 9cd918b commit 2e99b18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bootstrap/bootstrap.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ def default_build_triple(verbose):
333333
if ostype == "Android":
334334
kernel = "linux-android"
335335
else:
336-
kernel = "unknown-linux-gnu"
336+
python_triple = sys.implementation._multiarch
337+
if "musl" in python_triple:
338+
kernel = "unknown-linux-musl"
339+
else:
340+
kernel = "unknown-linux-gnu"
337341
elif kernel == "SunOS":
338342
kernel = "pc-solaris"
339343
# On Solaris, uname -m will return a machine classification instead

0 commit comments

Comments
 (0)