From 15d512cc35106392ed7583d0e000d9a1b865f1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Bo=C5=99ek?= Date: Mon, 27 Jun 2022 13:53:37 +0200 Subject: [PATCH 2/2] configure.ac: switch PLATFORM_TRIPLET suffix to '-musl' based on `host_os` instead of `build_os` As `build_os` and `host_os` are results of autoconf's `AC_CANONICAL_BUILD` and `AC_CANONICAL_HOST` macros[^1], the former refers to the system running the build and the latter to the system that will run the compiled program. `PLATFORM_TRIPLET` should refer to the target platform when cross-compiling. Its libc related part should be therefore derived from the target platform as well - which is currently not the case - `PLATFORM_TRIPLET` '-gnu' suffix is/isn't switched to '-musl' based on `build-os` rather than `host-os` which leads to error message[^2] and build failure when compiling Python on glibc system for musl target. [^1]: https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Canonicalizing.html , https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Specifying-Target-Triplets.html [^2]: "internal configure error for the platform triplet, please file a bug report" Co-authored-by: Pali Rohár Signed-off-by: Šimon Bořek --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/configure +++ b/configure @@ -5376,7 +5376,7 @@ EOF if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` - case "$build_os" in + case "$host_os" in linux-musl*) PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` ;; --- a/configure.ac +++ b/configure.ac @@ -866,7 +866,7 @@ EOF if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` - case "$build_os" in + case "$host_os" in linux-musl*) PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` ;;