Kernel has API based on interrupts and magic numbers. This API is too low-level and unfriendly for programmers, so libcs were invented. They expose functions, which are handy and call kernel API directly.

Fact 1: The Linux kernel API is very stable, so applications static-linked to old musl can expect old kernel API behavior to still work.

Fact 2: Static-linking musl into application makes the whole application call kernel API directly.

Fact 3: Application compiled with with static-linked musl will work on current and future versions of Linux using only bare kernel API.

Then why some distros have explicit musl support? Isn't having Linux-compliant kernel API enough?

Some of my "facts" must be invalid, because I can't answer my own question.


Your three facts are accurate enough, at least to understand what’s needed from a C library (at a high level).

I think what’s invalid is your understanding of “explicit musl support”. There are three types of distributions from musl’s perspective:

  • distributions which build all or most of their software using musl as the C library, for example Alpine; usually this is done to reduce the installation size (since musl is much smaller than the GNU C library);
  • distributions which don’t have any built-in support for musl;
  • distributions which provide musl as a service for their users, but don’t rely on it.

In the same way as any other binary, you can use a musl-dependent binary on any Linux distribution, as long as you also provide the required libraries. If it’s statically-linked, then there are no libraries to provide. There are no specific requirements on the distributions themselves.

You may be wondering about the third type above. Providing musl in a distribution which doesn’t rely on it is done to make life simpler for users who want to build binaries using musl: these distributions provide the musl libraries (static and dynamic, usually), header files, and compiler support required to build binaries using musl. This means that users can start building binaries using musl without having to install musl and configure their compiler themselves.

In general, the fact that some distributions support a given feature, while others don’t, doesn’t mean that that feature can’t be supported on the latter; it means that the end-user needs to do the work involved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.