Musl, verbalized much like the word “mussel” or “muscle”, is a “libc”, an utilization of the normal library usability expressed when you look at the ISO C and POSIX guidelines, plus typical extensions, constructed on top of the Linux program telephone calls API.

Musl, verbalized much like the word “mussel” or “muscle”, is a “libc”, an utilization of the normal library usability expressed when you look at the ISO C and POSIX guidelines, plus typical extensions, constructed on top of the Linux program telephone calls API.

Even though the kernel controls usage of equipment, ram, filesystems, while the advantages for accessing these means, libc is in charge of:

supplying C bindings for the OS interfaces

creating higher-level buffered stdio, mind allowance management, line design and synchronization procedure, shared room load, and so forth making use of lower-level user interface the kernel includes

carrying out the genuine selection regimens with the C terms like strstr , snprintf , strtol , exp , sqrt , etc.

musl have records and improvement roots going back to 2005, but was actually called and for starters introduced as musl in 2011, as an alternative to glibc and uClibc with a bold mission in order to satisfy the needs of both little embedded methods and normal desktops and hosts.

Since 2012, musl has become trained underneath the permissive MIT license.

Important Theory


The simpler signal is definitely, the significantly less room it has for pests, as well cheaper its to help big improvements if they are called for. Convenience can lead naturally to optimal code reasonably-good performance. musl prefers basic calculations over more complex data unless definitely a compelling purpose to complete if not. musl additionally favors reducing abstractions, retaining signal as self-contained/uncoupled as you possibly can. This tends to make they readable (although often heavy) and size-efficient once static-linked.

Reference results

Scaling very well “as n goes to 0” can point all the or even more than scaling “as n goes to ?”. Design surrounding this process started off with enclosed and low-end personal desktop computers at heart, but finished up carrying musl (and like-minded distributions) to prominence in the containers preparation wave.

Due to insufficient big interior coupling between libc components, static back linking with musl pulls in little or no signal that the program is not really utilizing. Minor static-linked binaries can be under 10 kB of signal, despite posts, and even of use programming can be under 50 kB.

The principle of lower constant cost relates to runtime useful resource eating nicely. libc’s very own worldwide information dimensions are stored no more than possible – under 8k, and possibly notably less once stationary back linking. For dynamic linking, all features is during one particular shared library data (than are broken across libm , libpthread , librt , etc.) to ensure there is no per-component memory and startup opportunity overhead.

Part of musl’s scaling “as n would go to 0” could be the capability to run-on smaller stacks, making creations including many thread practical even yet in resource-constrained circumstances.

Awareness to correctness

musl was initial Linux libc to have mutexes safe inside reference-counted elements, the first one to bring condvars in which newly-arrived waiters are not able to steal get events from past waiters, as well primary for employed line cancellation without raceway issues generating resource-leak or double-close. Each one of these were needs associated with the specification that were dismissed by different implementations, and receiving these people right had been a consequence of cautious reading of the needs.

musl’s whole growth traditions was an ongoing process of examining specifications, pursuing clarifications whenever corner cases are certainly not thoroughly discussed, and continuing with careful attention whenever using functions that is definitely underspecified.

Protection under reference tiredness

An element of correctness isn’t setting yourself up for a poor situation without having solution. musl always reserves sources for a procedure before investing they, backing completely if resources commonly readily available. Low-memory or other site fatigue issues will never be critical; they truly are always viewed (presuming a no-overcommit process settings) at a spot wherein they can be described, enabling the application to manage them mainly because it deems fit.

In general, musl stays clear of unwanted compelling allowance, and also has no active allowance whatsoever in code ways in which reporting problem into call just the possibility.

Easier deployment

musl’s MIT license works with all FOSS licenses, static-linking-friendly, and renders commercial need easy. Binaries statically associated with musl have zero additional dependencies, actually for characteristics like DNS lookups or character adjust conversion rates that are applied with compelling loading on glibc. A credit card applicatoin really can generally be deployed as a solitary digital file and run-on any equipment utilizing the adequate instructions ready buildings and Linux kernel or Linux syscall ABI emulation part.

Top-notch support for UTF-8/multilingual article

From even before musl is musl, remedy for all articles as UTF-8, and remedy for non-ASCII characters as superior, had been a heart need. No exterior locale applications or conversions segments are essential to endeavor UTF-8 or query hotels of absolute Unicode heroes. Even musl’s getopt let haphazard Unicode characters to be utilized as options.

DNS support for non-ASCII fields (IDN) is certainly not comprehensive yet but is going to be reinforced later.

Localization operation, a linked but different issue, can be now restricted but scheduled for big upgrades.

Getting going

Aided by the musl-gcc (or musl-clang ) wrapper sent with musl resource, it’s possible on x86 Linux as well as other famous archs to guage musl and create easy C programming by repurposing your body’s active glibc-based toolchain. For additional state-of-the-art usage including libraries or C++, though, a separate combination toolchain or constructing in a musl-based submission is preferred. Resources can be located of the area wiki’s Making an actual start page.