For most embedded Linux products on Cortex-A class hardware, use glibc. It is the default in both Yocto and Buildroot, vendor binary components such as GPU, NPU and video drivers are built against it, and it fully supports systemd and the common debugging tools. Choose musl when you build every binary from source, want small statically linked programs or a permissive licence, and are prepared to test thread stack sizes, DNS and locale behaviour, where musl differs from glibc. Changing the C library after release means rebuilding and requalifying the whole user space, so make the choice with the hardware roadmap in view.
Every program in an embedded Linux root filesystem calls into the C library for memory allocation, threads, file I/O, name resolution and time. The library is usually chosen once, when the first image is built, and today the realistic choice is glibc vs musl, with uClibc-ng as a third option for very small targets. This article treats it as an architecture decision: Context, Options, Decision and Consequences.
The context
The decision appears when you set up the build. In Yocto, the C library is selected by the TCLIBC variable in the distro configuration; the default is glibc, and setting TCLIBC = "musl" switches the whole build, including the locale provider. In Buildroot, the internal toolchain offers BR2_TOOLCHAIN_BUILDROOT_GLIBC, BR2_TOOLCHAIN_BUILDROOT_MUSL and BR2_TOOLCHAIN_BUILDROOT_UCLIBC. Buildroot changed its default from uClibc-ng to glibc in 2022; the maintainers’ stated reasons were that most users now have enough RAM and storage, and that glibc causes fewer problems overall. If you use an external or vendor toolchain, the C library is fixed by that toolchain, so the decision is made when you choose it.
# Yocto: distro configuration (glibc is the default)
TCLIBC = "musl"
# Buildroot: .config, internal toolchain
BR2_TOOLCHAIN_BUILDROOT_MUSL=ySeveral forces shape the choice:
- Binary-only components. GPU, NPU, ISP and video user-space drivers, inference runtimes and some commercial libraries arrive as prebuilt binaries. They are linked against a specific C library, and you cannot rebuild them.
- Init system and services. systemd has long been developed against glibc. Its musl support is recent and partial.
- Footprint. Storage and RAM limits matter, but the C library saving is often smaller than expected.
- Linking and licensing. Whether you want statically linked programs, and how your legal team treats the LGPL, both affect the choice.
- Team experience. Most developers, tools and third-party code are tested on glibc first.
Our comparison of Yocto vs Buildroot covers the build system; the glibc vs musl decision sits one level below it and applies to both.
The options: glibc vs musl vs uClibc-ng
Option 1: glibc
The GNU C Library is the C library of almost every desktop and server distribution. It is released twice a year; glibc 2.44 was announced on 25 July 2026. It is licensed under the LGPL, version 2.1 or later.
- Pros: prebuilt vendor binaries run without extra work. systemd is fully supported, including features that depend on the Name Service Switch (NSS). Locale and iconv support is complete. It has architecture-specific optimised string and memory routines. Debugging tools such as the sanitizers are best supported here. Security advisories are well tracked; the 2.44 release, for example, lists three CVE fixes, two of them in
gethostbyaddr. - Cons: it is larger. Static linking is limited: functions that go through NSS, such as
getaddrinfo, still need the shared libraries at run time, and the linker warns about this. Static linking against an LGPL library also brings relinking obligations that your licence compliance process must handle. On 32-bit targets, 64-bittime_tis opt-in through_TIME_BITS=64(glibc 2.34 and later), which also requires_FILE_OFFSET_BITS=64. Our post on 64-bit time_t and Y2038 explains why that matters.
Option 2: musl
musl is an independent C library written for correctness, simplicity and clean static linking. It is MIT licensed and is the default C library of Alpine Linux and OpenWrt. The current release is musl 1.2.6, announced on 20 March 2026.
- Pros: statically linked programs are simple to build and work as expected, which suits initramfs tools, rescue images and single-purpose devices. The permissive licence removes the LGPL questions. Since musl 1.2.0,
time_tis 64-bit on all architectures, including 32-bit ones. - Cons: the musl wiki documents behaviour that differs from glibc. The default thread stack is 128 KiB, against the 2–10 MB that glibc derives from
RLIMIT_STACK, so code with deep recursion or large local arrays can overflow.dlclose()does nothing, and lazy binding is not supported. The DNS resolver queries up to three nameservers in parallel, gained TCP fallback only in 1.2.4, and does not support IDN. iconv does not support//TRANSLIT. There is no NSS, so the systemd 259 release describes its musl support as incomplete, and features such as nss-systemd,DynamicUser=and systemd-homed do not work. glibc-linked binaries do not run directly; Alpine’s gcompat layer is suitable only for simple binaries. Some sanitizers are unavailable, and some allocation-heavy workloads are reported to run slower.
Option 3: uClibc-ng
uClibc-ng remains in Buildroot for space-constrained systems and for architectures that glibc does not support, such as no-MMU targets. OpenEmbedded-Core no longer offers it, and for a new MMU-based product it is rarely the right choice.
On size, measure before you assume. A comparison presented at Linux Plumbers Conference 2024 found a minimal Yocto qemuarm64 root filesystem of 17 MB with musl against 22 MB with glibc, while default Buildroot ARM64 images were about the same size with either library. On a product image with an application and its libraries, the difference is a small percentage.
To check which C library a running target uses, look at the dynamic loader:
raghu@techveda.org:~$ ls /lib/ld-*
/lib/ld-linux-aarch64.so.1A glibc system on 64-bit Arm shows ld-linux-aarch64.so.1; a musl system shows ld-musl-aarch64.so.1.
The decision
For the common case, a Cortex-A product with 256 MB or more of RAM, eMMC or similar flash, and some vendor-supplied components, choose glibc. It keeps every vendor binary and every systemd feature available, and it matches what your developers test on their workstations. The footprint cost is modest, and the static-linking limits rarely matter in a dynamically linked image.
Choose musl when all of the following hold:
- every binary on the device is built from source, and the hardware roadmap does not add a component with glibc-only binaries, such as an NPU runtime or GPU driver;
- you do not need the systemd features that depend on NSS, or you use a simpler init system, as discussed in our post on systemd vs BusyBox init;
- you value small statically linked programs or the MIT licence enough to justify the testing; and
- the team will test thread stack usage, DNS resolution and any locale or iconv handling on the target before release.
Router-class products and minimal single-function devices often meet these conditions, which is why OpenWrt uses musl. A hybrid is also possible: a glibc product can still carry a separately built, statically linked musl tool in its initramfs or recovery image, provided you maintain that second toolchain.
Consequences
With glibc, you accept a larger base image, you follow glibc security updates in your field updates, and any static linking must pass your LGPL compliance review. In return, adding a vendor SDK or a new service later is usually a packaging task, not a porting task.
With musl, you take ownership of compatibility testing. Application teams will meet thread stack overflows that never appeared on their workstations, DNS behaviour that differs from glibc, and libraries that assume glibc extensions. The larger risk in the glibc vs musl choice is a later hardware change: if the next revision adds an accelerator whose user-space stack is glibc-only, you must switch the C library, rebuild every package, retest the full system and ship a full-image update.
In either case, the C library is part of your ABI: a change of library, or of time_t width on a 32-bit target, invalidates every binary built against the old one. Record the decision and the conditions that would change it. If you are setting up a product build and want to practise these choices in Yocto, our Embedded Linux with Yocto training covers distro configuration and toolchain selection.
Key takeaways
- glibc is the default in Yocto (
TCLIBC) and in Buildroot’s internal toolchain, and it is the safe choice when any binary-only component is involved. - musl gives clean static linking, an MIT licence and 64-bit
time_teverywhere, but differs in thread stack size,dlclose(), DNS, locale and NSS. - systemd’s musl support, added in systemd 259, is incomplete; NSS-based features do not work.
- Switching the C library later forces a full rebuild and requalification, so check the hardware roadmap first.
Frequently asked questions
Is musl always smaller than glibc on an embedded Linux image?
No. A Linux Plumbers Conference 2024 comparison measured a minimal Yocto qemuarm64 root filesystem at 17 MB with musl and 22 MB with glibc, but default Buildroot ARM64 images were about the same size.
Can I run vendor GPU or NPU binaries on a musl root filesystem?
Generally not. Such binaries are linked against glibc. Alpine’s gcompat layer is suitable only for simple binaries, so a product that depends on glibc-only vendor components should use glibc.
Does systemd work with musl?
Partly. systemd 259 added incomplete, experimental musl support. Features that depend on NSS, such as nss-systemd, DynamicUser= and systemd-homed, do not work with musl.
Why do threaded programs crash on musl when they work on glibc?
A common reason is stack size. musl’s default thread stack is 128 KiB, while glibc’s default is derived from RLIMIT_STACK and is usually 2–10 MB. Code with deep recursion or large local arrays needs an explicit stack size, set with pthread_attr_setstacksize() or at link time with -Wl,-z,stack-size=N.
Further reading
- musl wiki: Functional differences from glibc
- musl 1.2.6 release announcement (20 March 2026)
- musl: time64 change in musl 1.2.0
- GNU C Library 2.44 release announcement (25 July 2026)
- Yocto Project Reference Manual: TCLIBC
- Buildroot: toolchain-buildroot default to glibc as the C library (2022)
- C Libraries in Build Systems, Linux Plumbers Conference 2024 (slides)
- systemd 259 and its incomplete musl support (The Register)
- Alpine Linux wiki: Running glibc programs



