libwhich
libwhich copied to clipboard
support linker files
Hi there, During the build of the archlinux aur/julia-git package I've encountered the following issue:
./libwhich -p libm.so
failed to open library: /usr/lib/libm.so: invalid ELF header
And indeed, I have
file /usr/lib/libm.so
/usr/lib/libm.so: ASCII text
On this site it is claimed, that
.so files are not designed to be loaded, but to be used at link time. Therefore it's perfectly fine for them to be a linker file.
What is should be the correct behaviour here?
strace -e openat ./libwhich -p libm.so
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/tls/x86_64/x86_64/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/tls/x86_64/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/tls/x86_64/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/tls/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/x86_64/x86_64/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/x86_64/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/x86_64/libm.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
openat(AT_FDCWD, "/usr/lib/libm.so", O_RDONLY|O_CLOEXEC) = 3
failed to open library: /usr/lib/libm.so: invalid ELF header
+++ exited with 1 +++
The goal of this package is to show you what would happen if you called dlopen on the string given as the command line argument. Since linux's behavior is to fail, that's the intended behavior here too.