Alternative libraries

From musl libc wiki
Jump to: navigation, search

Resource list for alternative libraries and programs that are lightweight, not bloated, efficient or have other useful design characteristics and may be useable with musl.

Alternative Libraries and Programs

  • pkgconf Drop in replacement for pkg-config with no circular dependencies. Does not require glib.
  • netbsd-curses Drop in replacement for ncurses and ncursesw, ported from netbsd. considerably smaller than ncurses.
  • mlibtool Drop-in replacement for libtool. can speed up builds significantly as it's written in C.
  • cDetect C replacement for feature detection generally provided by utilities like GNU autotools.
  • freeglut Replacement for glut.
  • libutf utf8 library (note that by using musl, UTF8 support is automatically enabled. no need to use any 3rd party library)
  • gettext-tiny gettext replacement. Provides a no-op implementation for libintl, and several no-op gettext utilities. Working msgfmt program.
  • gettext-stub Provides a stub replacement for libintl.
  • libdrpc Port of RPC based on Android's libdrpc. Replaces parts of older glibc RPC functionality and/or libtirpc.
  • libsep Minimal RPC library to assist compartmentalisation of small applications.
  • minised Faster but limited earlier version of sed. (note that busybox 1.20.2's sed implementation is 100% POSIX compatible and feature-complete)
  • ignite init replacement, works with runit.
  • linenoise lightweight readline replacement.
  • libedit drop-in replacement for readline (needs a handful of symlinks ). about 30% less code. lacks some rare functions but is compatible with a number of readline users like gdb.
  • termbox alternative to ncurses for simple terminal apps. 16 colors only. very small, clean, well designed code. only up to commit 66c3f91b
  • tinyalsa alternative to alsalib (interfacing with kernel's alsa API).
  • libnl-tiny drop-in replacement for netlink (libnl 1,2). may need some compatibility CFLAGS.
  • uuterm slim terminal emulator written by musl's author.
  • udhcpc small DHCP client, part of Busybox. use these two scripts to operate it.
  • ndhc small DHCP client, focus on security.
  • ubus replacement for dbus and general-purpose IPC protocol using simple unix domain sockets. does not require running a daemon.
  • mandoc alternative to massively bloated groff and accompanying manpage implementation.
  • moe A powerful and user-friendly console text editor (alternative to GNU Nano and Joe), but written in C++...
  • textadept Highly configurable and customizable text editor written in C (and lua) and based on Scintilla editor widget. Terminal version works with ncurses or pdcurses. Also check out Scinterm, the ncurses based version of the Scintilla editor component.
  • slock minimalist alternative to xlock and xlockmore.
  • star Alternative to GNU tar.
  • uSTL replacement for the C++ STL (Standard Template Library).


  • sortix libz cleaned up, modern fork of zlib.
  • libarchive bsdtar offers a replacement for gnu tar.
  • Lzip family of data compressors based on the LZMA algorithm. See Benchmark, and Quality-assurance.
  • XZ Embedded small xz decompressor library.
  • lzo very fast compression library.
  • gzfile.c C routines to read gzipped files.
  • miniz Single C source file Deflate/Inflate compression library with zlib-compatible API, ZIP archive reading/writing, PNG writing.
  • flate small gzip compatible compressor lib
  • lz4 extremely fast (BSD-licensed) compression algo
  • lz4 alternate lz4 impl (BSD-licensed), even smaller
  • basic compression library non-bloated (zlib-licensed) impl of several basic compression algorithms.

Large Text Compression Benchmark


  • TweetNaCl tiny, fully NaCl-compatible high-security crypto C library (single C file)
  • libtomcrypt public domain crypto library
  • kripto lightweight crypto library written in ISO C99. WIP.
  • libsodium encryption/decryption library
  • BearSSL compact state-machine-based tls library (MIT license), alpha as of 2016
  • tropicssl ssl library (BSD) - unmaintained and lacking a few patches for recent vulnerabilities found in PolarSSL.
  • polarssl ssl library (GPL) - commercialised and relicensed fork of tropicssl.
  • cyassl ssl library (GPL)
  • axtls ssl library (BSD license)
  • selene ssl/tls library (Apache license)
  • dropbear replacement for OpenSSH.
  • LibreSSL drop-in replacement for (and fork of) OpenSSL.


  • tinyCDB small constant database library. perl wrappers are available on CPAN.
  • LMDB high-performance, mmap'd key-value store used in the OpenLDAP project.


  • Agar MIT-licensed, lightweight GUI toolkit lib written in C
  • iup lighweight and portable GUI toolkit written in C, has lua bindings
  • mtk lightweight gui library written in C. currently writes directly to videomem of the milkymist open source hardware platform. requires port to X/SDL/FB.
  • GraphApp Toolkit for platform-independent graphical user interface programming in the C language.
  • m2tklib Mini Interative Interface Toolkit Library - a portable graphical and character user interface (GUI+CUI) library for embedded systems.
  • ftk GUI library for embedded systems.
  • SVG library
  • SDL_svg library
  • pnglite
  • simple-png
  • lodepng single-file implementation to read png files. requires zlib.
  • picojpeg
  • SOIL Simple OpenGL Image Library
  • gleri opengl implementation for remote GL usage.
  • TinyGL opengl implementation with software rendering. needs some fixes to work on 64bit archs.


  • mpv video player forked from mplayer2 with tons of junk removed. builds in seconds.

X11 alternatives


  • ucpp C99 preprocessor library and program.
  • mcpp another C99 preprocessor library and program.
  • sparse mostly C99 compatible semantic analyser and C frontend written by linus.
  • firm/cparser C99 compatible C compiler and optimization framework. x86 and SPARC backends.
  • GPP General Purpose Preprocessor. Has added functionality not available in a standard C preprocessor. Can be used as a preprocessor or working with templates.
  • vbcc mostly C99 compatible C compiler. open source but non-free LICENSE.

Scripting languages

  • Lua is a full-fledged small embeddable as well as standalone language. Pretty popular, but some semantic choices may make conscious programmer cringe: accessing non-existent (mistyped) variable returns legitimate value, array indexes start from 1, etc.
  • Quasar m4 is a small GNU m4-compatible re-implementation derived from the FreeBSD m4.
  • Squirrel is embeddable language with C-like syntax and minimal number of syntax/semantics idiosyncrasies. Uses reference counting. Core builds to ~250KB for i386. uses C++ though.
    • General-Purpose Squirrel - fork to make a standalone general-purpose language out of Squirrel core, without compromising on lightweightedness.
  • jim embedded tcl scripting engine in Ansi C. compiles to 100-200KB depending on featureset.
  • TinyJS An extremely simple (~2000 line) JavaScript interpreter.
  • 42TinyJS Fork of TinyJS with more functionality.
  • Quad-Wheel Small but full-ecma-262 supported javascript engine, written in ansi C.
  • tinypy Minimalist implementation of python in 64k of code.


Regular Expressions

Musl's regular expressions pattern matching routines are based on the TRE library. The Musl version of the code contains at least two bug fixes that were never fixed in the original code. For file pattern matching (fnmatch), musl uses an implementation based on the "Sea of Stars" algorithm.

Comparing Perl regular expressions implementations to Regex implementations shows pattern matching performance for various cases, but it can be like comparing apples to oranges. Perl regular expression pattern matching is not equivalent to a regular langauge which can be solved by a finite state automata. Some regex extensions also may not be compliant with the definition of a formal regular language.

  • Regular Expression Matching Can Be Simple And Fast One comparison between regex and Perl regular expressions.
  • Regex Benchmark Compares various regular expression methods' performances.
  • PCRE performance Comparison of PCRE JIT with other regular expression methods' performances. Older performance comparisons don't typically include PCRE JIT which has better performance than standard PCRE. They just use standard PCRE.

Code Collections and Basic Libraries/Programs

  • Toybox
  • Busybox
  • Heirloom Project
  • Utilities Chest a set of unix utilities written to be simple and small
  • picobsd
  • obase Port of OpenBSD userland to Linux
  • noXCUse New Open XCU Simple Edition; or, No Excuse for bloat and brokenness: a set of unix utilities developed by musl's author.
  • pikhq-coreutils a (small) set of unix utilities.
  • hardcore-utils a (small) set of unix utilities.
  • sbase portable set of suckless unix utilities
  • ubase linux-specific set of suckless unix utilities (util-linux replacement)
  • lazy-utils a (small) set of unix utilities to complement toybox
  • usul From the main developer of sbase. non-POSIX tabular Unix utilities.
  • lit cave Has a lot of lightweight replacement programs, including a troff implementation, utilities using framebuffer and a C compiler.
  • elks The elks tarball includes a collection ("elkscmd") of very lightweight standard unix programs, taken from minix and other sources. Also includes lightweight man alternative (bugfixed version is included in hardcore-utils).
  • Skarnet software Various utilities.
  • Bizarre Sources Init replacement and other small programs.

General Suggestions/Recommendations