musl is a
C standard library intended for
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s based on the
Linux kernel
The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ...
, released under the
MIT License
The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license co ...
. It was developed by Rich Felker with the goal to write a clean, efficient and standards-conformant libc implementation.
Overview
musl was designed from scratch to allow efficient
static linking
In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, produc ...
and to have realtime-quality robustness by avoiding
race conditions
A race condition or race hazard is the condition of an electronics, software, or other system where the system's substantive behavior is dependent on the sequence or timing of other uncontrollable events. It becomes a bug when one or more of ...
, internal failures on resource exhaustion and various other bad worst-case behaviors present in existing implementations.
The dynamic runtime is a single file with stable
ABI allowing race-free updates and the static linking support allows an application to be deployed as a single portable binary without significant size overhead.
It claims compatibility with the
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming inte ...
2008 specification and the
C11 C11, C.XI, C-11 or C.11 may refer to:
Transport
* C-11 Fleetster, a 1920s American light transport aircraft for use of the United States Assistant Secretary of War
* Fokker C.XI, a 1935 Dutch reconnaissance seaplane
* LET C-11, a license-build var ...
standard. It also implements most of the widely used non-standard
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
,
BSD
The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Be ...
, and
glibc
The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s by ...
functions. There is partial ABI compatibility with the part of glibc required by
Linux Standard Base
The Linux Standard Base (LSB) was a joint project by several Linux distributions under the organizational structure of the Linux Foundation to standardize the software system structure, including the Filesystem Hierarchy Standard used in the Li ...
.
Version 1.2.0 has support for (no longer current)
Unicode
Unicode, formally The Unicode Standard,The formal version reference is is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard, ...
12.1.0 (while still having full
UTF-8
UTF-8 is a variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit''.
UTF-8 is capable of ...
support, more conformant/strict than
glibc
The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s by ...
), and version 1.2.1 "features the new 'mallocng'
malloc
C dynamic memory allocation refers to performing manual memory management for dynamic memory allocation in the C programming language via a group of functions in the C standard library, namely , , , and .
The C++ programming language includ ...
implementation, replacing musl's original
dlmalloc-like allocator that suffered from fundamental design problems."
Use
Some
Linux distribution
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading on ...
s that can use musl as the standard C library include
Alpine Linux
Alpine Linux is a Linux distribution designed to be small, simple and secure. Alpine Linux uses musl, BusyBox and OpenRC instead of the more commonly used glibc, GNU Core Utilities and systemd respectively. ,
Dragora 3,
Gentoo Linux
Gentoo Linux (pronounced ) is a Linux distribution built using the Portage package management system. Unlike a binary software distribution, the source code is compiled locally according to the user's preferences and is often optimized for t ...
,
OpenWrt
OpenWrt (from ''open wireless router'') is an open-source project for embedded operating systems based on Linux, primarily used on embedded devices to route network traffic. The main components are Linux, util-linux, musl, and BusyBox. A ...
, Sabotage, Morpheus Linux and
Void Linux
Void Linux is an independent Linux distribution that uses the X Binary Package System (XBPS) package manager, which was designed and implemented from scratch, and the runit init system. Excluding binary kernel blobs, a base install is composed e ...
. The
seL4 microkernel ships with musl. For binaries that have been linked against glibc, gcompat
can be used to execute them on musl-based distros.
See also
*
Bionic libc
*
dietlibc
dietlibc is a C standard library released under the GNU General Public License Version 2, and proprietary licenses are also available. It was developed with the help of about 100 volunteers by Felix von Leitner with the goal to compile and li ...
*
EGLIBC
*
glibc
The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s by ...
*
klibc
*
Newlib
*
uClibc
__NOTOC__
In computing, uClibc (sometimes written µClibc) is a small C standard library intended for Linux kernel-based operating systems for embedded systems and mobile devices. uClibc was written to support μClinux, a version of Linux not ...
References
External links
*
Comparison of C/POSIX standard library implementations for LinuxMatrix of C/POSIX standard libraries by architectureProject:Hardened musl on Gentoo wiki* Rich Felker held a talk at the
Embedded Linux Conference (ELC) 2015
ELC 2015 - Transitioning From uclibc to musl for Embedded Development - Rich Felker, Openwall
{{CProLang
C standard library
Free computer libraries
Free software programmed in C
Interfaces of the Linux kernel
Linux APIs
Software using the MIT license