From 8e8b5545898651f81f6beeece760ee11aa9bffe2 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 11 Sep 2024 17:03:02 +0200 Subject: [PATCH] Find libc.so directly in musl systems --- constructor/header.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/constructor/header.sh b/constructor/header.sh index 2edb0ca4..bd67fad9 100644 --- a/constructor/header.sh +++ b/constructor/header.sh @@ -37,8 +37,12 @@ fi min_glibc_version="__MIN_GLIBC_VERSION__" case "$(ldd --version 2>&1)" in *musl*) - # musl ldd will report musl version; call ld.so directly - system_glibc_version=$($(find /lib/ /lib64/ -name 'ld-linux-*.so*' 2>/dev/null | head -1) --version | awk 'NR==1{ sub(/\.$/, ""); print $NF}') + # musl ldd will report musl version; call libc.so directly + libc_so="$(find /lib /usr/local/lib /usr/lib -name 'libc.so.*' -print -quit 2>/dev/null)" + if [ -z "${libc_so}" ]; then + libc_so="$(strings /etc/ld.so.cache | grep '^/.*/libc\.so.*' | head -1)" + fi + system_glibc_version=$("${libc_so}" --version | awk 'NR==1{ sub(/\.$/, ""); print $NF}') ;; *) # ldd reports glibc in the last field of the first line