Why musl?
musl was chosen over glibc as the default for several reasons:| Property | musl | glibc |
|---|---|---|
| Binary size | Very small (~600 KB) | Large (several MB) |
| Static linking | Excellent support | Problematic with some features |
| Security | Clean, auditable codebase | Larger attack surface |
| Standards compliance | Strict POSIX compliance | Extensions and GNU-isms |
| Startup overhead | Low | Higher (dynamic linker is heavier) |
| Locales | Minimal built-in | Extensive (larger footprint) |
musl Source Location
musl Configuration
The only musl-specific menuconfig option is:ENOSYS for SHA-256/SHA-512/Blowfish hashes.
Switching to glibc
To use glibc instead of musl:Binary Compatibility
Binaries compiled against musl are not compatible with systems using glibc, and vice versa. This means:- Precompiled binaries from a Debian/Ubuntu host will generally not run on an OpenWrt device (which uses musl)
- OpenWrt packages from a musl build will not run on a system using glibc
- Static binaries (linked with
-static) are the exception: they embed the libc and are self-contained
If you need to run third-party glibc-linked binaries on OpenWrt,
musl-libc includes a compatibility shim. However, full glibc compatibility is not guaranteed.Fortify Headers
OpenWrt’s musl build includes fortification headers fromtoolchain/fortify-headers/. These provide compile-time and runtime buffer overflow detection for common C functions (memcpy, strcpy, etc.) when the target includes musl.
Fortification is enabled when:
TOOLCHAIN_INC_DIRS includes .../include/fortify when CONFIG_USE_MUSL=y).
C++ Support
For C++ applications on constrained targets, OpenWrt provides:- libstdc++: The standard GCC C++ library. Pulled in as a dependency when any C++ package is installed.
- uClibc++: A minimal C++ library (
uclibc++package) for extremely size-constrained applications. Does not support the full C++11/14/17 feature set but produces much smaller binaries.
package/libs/uclibc++ and is used by packages that explicitly select it via DEPENDS:=+uclibc++.