Skip to content

Commit

Permalink
Find libc.so directly in musl systems
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Sep 11, 2024
1 parent a4a8ffe commit 8e8b554
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e8b554

Please sign in to comment.