Provided binaries do not work on systems with musl libc
Description
When attempting to run built binaries on musl libc systems, it errors out with "No such file or directory". This is because of an error with the expectations of the dynamic loader when the binary is compiled under GNU libc systems. On musl libc systems it is at a different location. This error is from the kernel, which attempts to load the ELF file based on the dynamic loader set in the binary, which does not exist on pure musl libc systems, such as the Alpine Linux I am running.
Installing the gcompat package does not work in this case either, this is because a symbol that is expected to be in the system does not exist. That is in the third log attached.
To Reproduce
- Run a musl libc system
- Attempt to run the
spotifydbinary from thespotifyd-linux-full.tar.gzpackage - See either
"/bin/mksh: ./spotifyd: No such file or directory", or"Error relocating /home/alx/spotifyd: __res_init: symbol not found"ifgcompatis installed.
Expected behavior Spotifyd should run normally.
Logs
Click to show logs
17:31 alx$ ./spotifyd --help
/bin/mksh: ./spotifyd: No such file or directory
17:31 alx$ file spotifyd
spotifyd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=390a4e2257311a539b75aad70dfc68a97ef05707, with debug_info, not stripped
17:32 alx$ ls -l spotifyd
-rwxr-xr-x 1 alx alx 18349168 Jan 24 2020 spotifyd
17:32 alx$ ./spotifyd --verbose
/bin/mksh: ./spotifyd: No such file or directory
As you can see the interpreter is interpreter /lib64/ld-linux-x86-64.so.2, this directory does not exist on my system. Where the default is /lib/ for 64 bit. In addition, the ld-linux-x86-64.so.2 binary does not exist on my system, as the loader is ld-musl-x86_64.so.1:
17:35 alx$ ls /lib64/
ls: cannot access '/lib64/': No such file or directory
17:36 alx$ ls /lib/ld-musl-x86_64.so.1
/lib/ld-musl-x86_64.so.1
17:36 alx$
When the package gcompat, which provides /lib64/ld-linux-x86-64.so.2, is installed, you instead get the following error:
17:40 alx$ sudo apk add gcompat
(1/2) Installing libucontext (0.11-r0)
(2/2) Installing gcompat (0.9.0-r2)
OK: 9834 MiB in 2012 packages
17:41 alx$ ./spotifyd --verbose
Error relocating /home/alx/spotifyd: __res_init: symbol not found
Compilation flags
- N/A
Versions (please complete the following information):
- OS: Alpine Linux Edge
- Spotifyd: Release 0.2.24 (latest release)
- cargo: N/A
Additional context Suggested resolution: Add a musl libc linux distribution to the list of build systems.
Ye, we'd have to add it to CD. There was one earlier on but I am not sure why it got removed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Requesting this to be opened again given that there are still no builds for musl systems
Pleease add builds for Alpine, I bought Dell Wyse thinclient with only 8gb MMC and want it to run only apline and spotifyd
@aleksasiriski I actually thought about this a few days ago when fighting with cross compiling for glibc. So when I have the time, I'll try to look into this.