How to Use musl

In an established application binary ecosystem, the C library is one of the the most difficult components to swap out and replace. Everything depends on the interfaces it provides. musl is designed to be simple and efficient to use whether as the system-wide libc or a tool for making robust static-linked applications.

The musl development and user community is dedicated to supporting three major ways of using musl:


With the musl-gcc wrapper, to make easy-to-deploy static linked or minimally dynamic linked programs.

$ ./configure && make install
$ cat > hello.c << EOF
#include <stdio.h>
int main(int argc, char **argv) 
{ printf("hello %d\n", argc); }
$ musl-gcc -static -Os hello.c
$ ./a.out
hello 1
$ size ./a.out
   text    data     bss     dec     hex filename
  13302     140    1152   14594    3902 a.out

musl makes this usage simple with a fast and non-invasive build process and a wrapper script for reusing the existing GCC toolchain on the host.

Get started by downloading the latest source release or cloning the git repository.


As the system-wide libc in a musl-based Linux distribution or mini-distribution. These mostly take the form of source-based build systems based on the principles of Linux From Scratch, with the addition of new package management tools.

Core: musl and compiler toolchain, usually built on host system.
Base: essential packages, possibly built on the host system using a cross-compiler or the musl-gcc wrapper, or inside a chroot target or virtual system.
Extras: selection of additional programs that can be built on the target base system once it’s operational.

See the musl community wiki for information on musl-based distributions.


As the basis for building your own system. Project possibilities include:

  • Multimedia appliances
  • Routers / Firewalls
  • VoIP devices
  • Rescue disks
  • Mobile phones
  • Kiosks
  • Light desktop systems

The musl-gcc wrapper script, a full musl-based host system with development environment, or musl cross compilers can be used to bootstrap new systems based on musl.