Musl vs glibc. The first one provides binaries linked with glibc and musl.
Musl vs glibc It could be GLIBC, uClibc, Musl, Apple libc, or some other libc. Some argue for musl's security, size, and speed, while others complain about compatibility and functionality issues with musl. musl VS glibc Compare musl vs glibc and see what are their differences. glibc goes beyond the libc standard (or even sometimes goes against the standard), these features are called glibc-ism and make cross-libc/cross-platform compatibility a nightmare. 5 to x2. Some of musl’s major advantages over glibc and uClibc / uClibc-ng are its size, correctness, static linking support, and clean code. Distributions Glibcis used in majority of distribution Fedora-like, RHEL, Debian-like, SuSE, Gentoo, Archlinux. Nov 21, 2021 · Musl is a C library built to be very space efficient compared to Glibc. The musl team claims that there is no need of a way of detecting musl libc because they only implement standard functionality and have no quirks that need detecting. Musl tries to stick to the standard. musl is supported by Gentoo for most common CPUs on most Architectures. About Introduction musl, pronounced like the word “mussel” or “muscle”, is a “libc”, an implementation of the standard library functionality described in the ISO C and POSIX standards, plus common extensions, built on top of the Linux system calls API. Up until today, that claim may The only reason systemd requires glibc is that glibc provides features systemd uses, and musl doesn't. May 24, 2022 · Musl is an implementation of the C standard library, just like the GNU C Library (glibc) or the BSD libc. Feb 2, 2025 · In a real world benchmark, the default musl allocator caused a 7x slowdown compared to other allocators. I was really impressed with musl on embedded Linux so I started to explore it on PC, which Dec 24, 2016 · I'm just chiming in to report an observation with compiling Rust applications using both the glibc (default) and musl targets, as well as jemalloc versus system-alloc. For embedded devices, Musl may be a good option for you. Some other well-known implementations are the Microsoft Visual C Runtime (which includes a libc), musl 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. Whereas the kernel (Linux) governs access to hardware, memory, filesystems, and the privileges for accessing these resources, the C library is responsible for providing the actual C Glibc is by far the most common one and is faster than Musl, but Musl uses less space and is also written with more security in mind and avoids a lot of race conditions and security pitfalls. If musl also provided those features, systemd would be able to be built against musl. glibc could be configured to send those requests sequentially, with single-request and single-request-reopen options, but musl cannot. See the table and notes for details and differences between the libraries. Proprietary software is compiled with glibc and will not work with musl (steam, nvidia drivers, zoom, etc. Yes, musl is faster, but not too much (I'd say like x1. It is instead recommended that any software that requires glibc APIs be modified 文章浏览阅读4. Musl is used on some distributions like Alpine Linux. I Dec 24, 2016 · I'm just chiming in to report an observation with compiling Rust applications using both the glibc (default) and musl targets, as well as jemalloc versus system-alloc. Introduction Getting Typically glibc is linked to dynamically and musl is linked to statically. discoversdk. Glibc is one of many different implementations of libc. so. If you intend to run a desktop, it is recommended to run Glibc as most applications are made with Glibc in mind. This guide is about using musl libc, for a development guide, see musl porting notes. As Alpaquita Linux has two variations, with glibc and musl, we tested both of them plus the stock musl-based variant to see whether there is a difference in results. Alpaquita Linux has two libc variants based on two different libc implementations, namely glibc and musl. For all Linux distros, the C standard library is extremely important. https Aug 31, 2022 · musl官网有不支持的功能以及和glibc行为上的差别: Functional differences from glibc 从性能上看, malloc系列函数和memcpy系列函数可能实现较慢. This is a wiki maintained by the enthusiastic user community of musl. Jul 5, 2025 · The musl project has a goal similar to its sister subproject, Hardened uClibc, but with the intention of using musl to replace glibc as the system's "standard C library" or "libc" for short. [3] It was developed by Rich Felker to write a clean, efficient, and standards-conformant libc implementation. Updated daily. A system's libc forms an integral part of the toolchain, but unlike the other components, it remains a runtime dependency of nearly every dynamically linked object in the system, or becomes incorporated Dec 25, 2019 · Discussion on differences between glibc, musl, and uclibc libraries in Gentoo, with a resolved solution provided. musl FAQ What is musl? musl is a “libc”, an implementation of the standard library functionality described in the ISO C and POSIX standards, plus common extensions, intended for use on Linux-based systems. Everything depends on the interfaces it provides. This design helps achieve at least four goals: Reducing bloat and startup overhead: Each additional dynamic object, including the dynamic linker Sep 30, 2021 · There's musl which is (maybe too strictly) standards-compliant, quite a number of smaller embedded-focused libc's like newlib or uClibc, there is also bionic which mostly aims at supporting Android, there is a libc written in Rust and even the LLVM project is creating their own C standard library. org Aug 8, 2025 · Compare musl and glibc with our in-depth guide covering their pros, cons, and key differences. glibc can be faster than musl (glibc has some inline assembly here and there to improve performance), but musl has a (arguably) cleaner codebase. Should I go for glibc or uClibC ? How uClibC and glibc are compared with respect to musl's efficiency is unparalleled in Linux libc implementations. 2 Cons Musl may not support all programs The table below and notes which follow are a comparison of some of the different standard library implementations available for Linux, with a particular focus on the balance between feature-richness and bloat. d/ containing your custom path. glibc -compiled programs and all glibc compilations were done on Debian. 28) could opt-in for jemalloc or tcmalloc and pay for it with binary size and compilation time. It was a little slower to boot since glibc‘s heap manager is more aggressively over-allocating memory but in turn hits the OOM-killer earlier if stressed. 0) , and it need real time behavior. So for consistency I would like to keep things on Debian. Glibc is currently much faster in many cases, but the cleanliness of the musl implementation can make it much easier to understand or audit. musl is further represented by two variants, such as musl-default and musl-perf, and can be easily changed on the installed system using the apk package manager. Nov 20, 2023 · the musl FAQ states that: Binary compatibility is much more limited, but it will steadily increase with new versions of musl. If you want to add your library in a non standard path, please add a config file under /etc/ld-musl-$ARCH. In addition to the built-in allocators, there are a number of other external allocators that are available for both glibc and musl: Jan 5, 2019 · Libc is the name of the standard library for the C programming language. 4k次,点赞8次,收藏16次。本文对比了C语言标准库glibc和musl的差异,glibc以其广泛的功能和兼容性适用于多数Linux系统,而musl则以其轻量级、快速和可移植性适合嵌入式和高性能应用。musl支持静态链接、实时性和内存效率,glibc则提供了更多的扩展功能。选择依赖于具体需求和目标环境。 Mar 23, 2023 · 如果你是一个 Linux 用户,那你一定至少听说过 Glibc 的鼎鼎大名,或者甚至在日常使用中碰到不少关于它的问题,例如 Glibc 版本不匹配等问题。而本文的主角—— Musl libc 与之相比就要默默无闻的多,那么为什么我们会需要另一个 libc 函数库呢? From the perspective of auditing a possible security vulnerability I'd link you this blog post that made the rounds a couple weeks ago wherein the author debugs a small problem in his code that's causing a segfault in one libc but not another. Designed from the ground up for static linking, musl carefully avoids pulling in large amounts of code or data that the application will not use. Nov 4, 2015 · So I'm playing with Alpine Linux, which uses musl vs glibc. But recently I've been wondering: why not just publish (b) since it's more portable? Sure, the binary is a little bigger, but the difference seems inconsequential Jan 23, 2013 · I am writing a user space audio application which runs over Linux (Kernel 3. Also note that openrisc has been mostly superceded by risc-v, which afaik glibc and musl both support; don't know about the other libcs. LGPL Licensed Supports a myriad of architectures (musl < uclibc < glibc) uses glibc headers vs musl uses its own Specific purpose vs General purpose (musl and glibc) musl musl is a libc implementation which strives to be lightweight, fast, simple, and correct. 0 depending on hardware and memory (RAM)). You can statically link glibc, but it's highly discouraged: Due to its internal design Nothing about musl or any other libc implementation prevents developers from including the linux headers and using whatever linux-specific functionality they like. As an added bonus, musl is also more secure than Glibc. Aug 31, 2022 · musl官网有不支持的功能以及和glibc行为上的差别: Functional differences from glibc 从性能上看, malloc系列函数和memcpy系列函数可能实现较慢. I've seen speedups ranging from 50% to 1000% faster. The first one provides binaries linked with glibc and musl. It does not contain any headers, and cannot be used to build software that requires glibc. Jul 23, 2025 · Today, glibc has become the default implementation of the C standard library across the majority of Linux distributions, including Ubuntu, Debian, Fedora, and even Chainguard’s Wolfi. To install issue the command: apk add gcompat After that you run your binaries as normal. The second provides binaries linked with musl (Linux), the GNU version perhaps is compiled using MinGW A project of Eta Labs that compares musl, uClibc, dietlibc and glibc on various features, performance, bloat and ABI. Software compatibility, patches and build instructions pkgsrc based software compatibility table: Pkgsrc results outdated. musl libc (muslc) is a new C library aiming to be lightweight, fast, simple, free, (annoyingly) correct. 尤其是malloc的性能, 在多线程环境下会显著造成瓶颈, 原因在于musl的malloc实现在每次malloc时都需要对全局变量加锁解锁, 导致严重的竞争现象. Is musl supposed to be Dec 12, 2024 · As Alpaquita Linux comes with two libc implementations, glibc and musl-perf, we tested musl- and glibc-based distributions to compare the performance of two libc implementations. musl Unofficial mirror of etalabs musl repository. This guide should help you decide which to choose. 1 Pros Musl is extremely lightweight and easy to build, compared to Glibc. It is a replacement for the widely used GNU C library (glibc). compare products glibc vs musl libc on www. Apr 18, 2022 · GNU C Library (glibc) is the standard library used on many distributions. musl-libc. At present, some glibc-linked shared libraries can be loaded with musl, but all but the simplest glibc-linked applications will fail if musl is dropped-in in place of /lib/ld-linux. 1. I think it also has less extensions than glibc. Chroot Main article: Chroot Functional differences from glibc Comparison with other Linux libc implementations. Dynamic linking is also efficient; by integrating the entire standard library implementation, including threads, math, and even the dynamic linker itself into a single shared object gcompat gcompat is a library which provides glibc-compatible APIs for use on musl libc systems like Alpine Linux. Musl recieves the most support from the Everest development team. Void officially supports musl by using it in its codebase for all target platforms (although binary packages are not available for i686). Musl really used less memory both on flash and RAM. Sep 13, 2024 · musl Security Musl’s design prioritizes simplicity and correctness, which naturally leads to a smaller attack surface compared to glibc. While the kernel governs access to hardware, memory, filesystems, and the privileges for accessing these resources, libc is This distribution contains the implementation of gcompat, a library which provides glibc-compatible APIs for use on musl libc systems. There are trade offs between dynamic and static linking, but you typically want to link dynamically. security, musl is build with a strong security focus, being much smaller than glibc, makes the attack surface also smaller. AFAIK there was some problem with their initial specification that caused them to want not to implement them, and c18 amended that so they're now comfortable supporting them. Linux/BSD since 2001. 然而musl的源代码很简单 glibc VS musl Compare glibc vs musl and see what are their differences. For my projects, I've been publishing two flavors of Linux binaries for each release: (a) a libc version for most GNU-based platforms, and (b) a statically-linked musl version for stripped-down environments like tiny Docker images. For an usage example, refer Firefox page, where gcompat is used to run glibc compiled Widevine binary. Although you could use flatpaks to use those. (by bminor) scripts to compare performance between musl and glibc - ashamedbit/musl-vs-glibc Using musl Contributing Development Further reading musl libc musl is a C standard library implementation for Linux. Whereas the kernel (Linux) governs access to hardware, memory, filesystems, and the privileges for accessing these resources, the C library is responsible for providing the actual C Mar 15, 2018 · Optimizing Rust Binaries: Observation of Musl versus Glibc and Jemalloc versus I’m just chiming in to report an observation with compiling Rust applications using both the glibc (default) and musl targets, as well as jemalloc versus system-alloc. 1 (Release date: August 4, 2020) musl uses new allocator. I have tried to be fair and objective, but as I am the author of musl, that may have influenced my choice of which aspects to compare. Eventually, LLVM-libc may be ready and could be used as well. In all the scenarios I’ve tried, musl-compiled Rust binaries are significantly At work I had to replace glibc on an embedded device with musl to make room for growing FPGAs. Just go with glibc, you can switch to musl later on (if you wish so). musl is a C standard library intended for operating systems based on the Linux kernel, released under the MIT License. In all the scenarios I've tried, musl-compiled Rust binaries are significantly faster than their glibc counterparts, so it's worth investigating this in your own projects. See full list on wiki. that glibc has; even the dynamic linker (in the elvish language, “program interpreter”) is unified with libc. Jun 17, 2023 · Back to home Musl or Glibc? Everest supports 2 different C libraries, musl and glibc. The musl development and user community is dedicated to The issue with musl was a subpar allocator, butyou could have always (since rust 1. Update: Oct 14, 2022 · We utilized both musl- and glibc-based distributions to compare the performance of two libc implementations. ). Choose glibc. It has alot of compatibility but it is NOT completely compatible. Since 1. . 2. The necessary patches are at musl-pkgsrc-patches (hg) or musl-pkgsrc-patches (git). 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. However if you statically link Nov 24, 2019 · In either case, the answer is: whichever libc you told it to use (either at clang configuration time, or at the time of linking the final binary). 1 - musl 1. If you run Void on hardware not older than 8, 9 years, you probably won't notice the difference in speed between the two. It's faster than the old one, but still looses to jemalloc. 然而musl的源代码很简单 Oct 6, 2020 · However, I am trying to run some benchmarks of musl vs. If musl’s resolver is requested to translate a hostname to IPv4 and IPv6, both requests will use the same socket, same as glibc. Learn which C library is best for your Linux environment. Users of Void Linux, a general operating system based on the Linux Kernel, share their opinions on the pros and cons of using musl or glibc as the C library. com: Compare products The musl runtime uses a similiar aproach for configuring shared library paths as glibc. Should note that glibc now supports c11 threads. I'm finding out that because of this choice I can't run Oracle Java, or static go binaries built under glibc. The reason is that if a library you link to has a vulnerability and needs to be patched, then your user only needs to update their local copy and it will be fixed for all of its dependents. Build instructions and patches for various software Apr 18, 2011 · Design Concepts Unified libc/libpthread/ldso Not only does musl lack separate broken-down libraries like libpthread, libm, librt, etc. Another musl-based distribution in the tests was Alpine Linux, which comes with stock musl. musl (pronounced “muscle”) was first released in 2011 as an alternative to glibc. Aug 16, 2023 · Is there any performance difference if I use a images such as Alpine that rely on musl rather than for example a Ubuntu image with libc for production deployments? and is any such difference jit related? Yes, there’s a significant loss in performance with musl. I recommend all Rust projects immediately swap to a different allocator in a musl environment. This library is designed to be used for binaries that are already compiled against glibc. In particular, Glibc is the libc implementation that is developed and maintained as part of the GNU project. Jul 1, 2025 · musl is a standard C library implementation that strives to be lightweight and correct in the sense of standards. I Compare glibc and musl variants of DHIs to choose the right base image for your application’s compatibility, size, and performance needs. Buildroot Uclibcand glibc OpenEmbedded Uclibc/glibc/musl Alpine Uclibc/musl musl FAQ What is musl? musl is a “libc”, an implementation of the standard library functionality described in the ISO C and POSIX standards, plus common extensions, intended for use on Linux-based systems. Mar 19, 2025 · Learn about the GNU C Library (glibc) and why this component is important for programming and using Linux software. wxuwh itjhh ebapbfd vonhhu kafcjq srimyv ecks sxef ootqd wnspls zwau bylj bkltv atqe hlcx