The value of $host_os, determined by the current config.guess, is:
- On Alpine Linux 3.9: linux-musl
- On Alpine Linux 3.10: linux-gnu
- On Alpine Linux 3.12: linux-musl
The reason is that config.guess tests 'ldd --version'. However, in
Alpine Linux 3.10, /usr/bin/ldd has been replaced with a shell script
that does not understand the --version option:
$ cat /usr/bin/ldd
#!/bin/sh
exec /lib/ld-musl-x86_64.so.1 --list -- "$@"
$ /usr/bin/ldd --version 2>&1
/lib/ld-musl-x86_64.so.1: cannot load --version: No such file or directory
Find attached a proposed fix. More details in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00098.html>.
Bruno
>From 6e8da56c68ad94175d67acfc6257e614fe74e01d Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 19 Sep 2020 15:24:59 +0200
Subject: [PATCH] * config.guess: Fix determination of musl libc on Alpine
Linux 3.10.
---
ChangeLog | 5 +++++
config.guess | 14 ++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4f106db..834f4e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-19 Bruno Haible <bruno@clisp.org>
+
+ * config.guess: Don't use 'ldd --version' to determine the presence of
+ musl libc, as this fails on Alpine Linux 3.10.
+
2020-09-08 Elad Lahav <e2lahav@gmail.com>
Ben Elliston <bje@gnu.org>
diff --git a/config.guess b/config.guess
index 9aff91c..8d70ec2 100755
--- a/config.guess
+++ b/config.guess
@@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2020-08-17'
+timestamp='2020-09-19'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -150,17 +150,15 @@ Linux|GNU|GNU/*)
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
+ #include <stdarg.h>
+ #ifdef __DEFINED_va_list
+ LIBC=musl
+ #else
LIBC=gnu
#endif
+ #endif
EOF
eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's,
,,g'`"
-
- # If ldd exists, use it to detect musl libc.
- if command -v ldd >/dev/null && \
- ldd --version 2>&1 | grep -q ^musl
- then
- LIBC=musl
- fi
;;
esac