logoalt Hacker News

nomeltoday at 12:41 AM5 repliesview on HN

I don't know much about musl.

> GPU: Vulkan and OpenGL drivers are supplied by the host as shared objects, usually built against glibc, and a fully static musl binary cannot normally dlopen() them.

Why? Have people managed to break the ancient concept of shared libraries, and this is a fix for that?


Replies

okanattoday at 12:51 AM

Because glibc and GNU set a terrible precedent. On GNU/Linux systems the shared binary interpreter / loader, GCC compiler, the C library and the system C/C++ ABI all depend into each other. You cannot change any of them independently. All shared libraries depend on the specific glibc version to load them into memory to be able to use that specific glibc version as their C library and make calls like dlopen.

Shared libraries have always been broken in Linux. Unfortunately many things like GPU drivers, graphics libraries and NSS need shared libraries to dynamically load certain runtimes (because you don't want to load all possible GPU drivers in existence to your RAM). So an ecosystem has been developed on top of terrible ABI and architecture GNU/glibc provided.

show 6 replies
pjmlptoday at 8:20 AM

Because many folks don't understand UNIX systems introduced dynamic linking for several reasons, and they actually only had static linking for almost 20 years, since UNIX was known outside Bell Labs.

Additionally many other OSes have had both approaches since their early days, Xerox PARC ones.

For some strange reason they assume to know better than all those researchers.

show 1 reply
akerl_today at 12:59 AM

musl has no problem building and using shared libraries.

What you can't do is build something statically with musl and then reliably dlopen shared libraries built with glibc.

show 1 reply
shevy-javatoday at 8:11 AM

> Why? Have people managed to break the ancient concept of shared libraries

If you break or remove a shared lib here, you may no longer be able to compile something from source. I had that happen in the past before I started to use more statically compiled programs (and busybox too).

Assuming everything works as-is via shared libraries at all times, makes little sense for ALL linux systems. For instance, some people upgrade glibc manually. Then you need a working base system to resume compilation. I do that for my customized gobolinux system, so I can use any program version as well as any glibc version (assuming I can still compile the program; many older programs no longer compile).

ranger_dangertoday at 12:46 AM

musl does not perfectly emulate all aspects of glibc, so trying to use libraries that assume glibc can sometimes lead to problems.

show 1 reply