Skip to content

Commit a24eae4

Browse files
committed
tools/get-libc-dir: Add support for musl
The assumption that libc.so resolves to a library called libc.so* breaks down on musl-based systems, where libc.so is implemented internally by the dynamic loader. $ ldd /bin/bash /lib/ld-musl-x86_64.so.1 (0x7fb99fd94000) libreadline.so.8 => /lib/libreadline.so.8 (0x7fb99fc59000) libtinfo.so.6 => /lib/libtinfo.so.6 (0x7fb99fc21000) libc.so => /lib/ld-musl-x86_64.so.1 (0x7fb99fd94000) libtinfow.so.6 => /lib/libtinfow.so.6 (0x7fb99fbe9000) Signed-off-by: Gabi Falk <[email protected]>
1 parent 2c92753 commit a24eae4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/get-libc-dir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ libc="$(
55
ldd "$BASH" |
66
sed -n -e 's|[[:space:]]*libc\.so.*[[:space:]]=>[[:space:]]\(/.*\)[[:space:]](0x.*$|\1|p'
77
)"
8-
printf '%s\n' "${libc%/libc.so*}"
8+
printf '%s\n' "${libc%/*}"

0 commit comments

Comments
 (0)