系统与基础设施etalabs.net
Linux 上 C/POSIX 标准库实现比较
Comparison of C/POSIX standard library implementations for Linux
2014 — 2025,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这个页面比较 Linux 上几种 C/POSIX 标准库实现(如 glibc/eglibc、uClibc、dietlibc、musl 等),从支持的架构、体积、功能完整性和标准符合性等角度列出差异。它更像一份面向选型和移植的参考表,尤其适合嵌入式、静态链接以及想弄清各 libc 取舍的读者。
为什么经久不衰:libc 的选择会长期影响可移植性、二进制体积和部署方式,而这份对照表把关键差异集中在一页,因此多年后仍是快速入门和复查的经典参考。
HN 评论精选
dietlibc 以极小体积为目标,架构和功能完整性可能不足,x86_64 上尤甚。
dietlibc 的架构支持部分在我看来过于乐观。我遇到过不少函数(尤其是浮点相关函数)在 x86_64 上根本没有实现,而在 x86 上却可用。不过要理解 dietlibc 的来历:原作者曾在一家德国公司做基于 Linux、DirectFB 等技术的数字电视机顶盒/接收器,所以满足其需求并激进优化体积一直是优先项,即使部分功能不符合标准。披露:我给 dietlibc 贡献过几个补丁。
_ak查看英文原文
The section on architecture support of dietlibc is too optimistic, IMHO. I stumbled upon quite a few function, esp. floating-point-related functions, that simply aren't implemented on x86_64 while they're available while they're available on x86. But then one needs to understand the background of how and why dietlibc came to be: its original author used to work for a German company developing digital TV set-top boxes and receivers, based on Linux and technologies like DirectFB, so obviously supporting their requirements and optimizing for size aggressively, even if some functionality is non-conformant, has always been a priority. Full disclosure: I contributed a few patches to dietlibc.
musl 以小巧、正确、易静态链接和源码可读著称。
musl 是一个很好的 libc,小而正确,团队也容易合作。特别是想静态链接出完全独立的可执行文件时,它很合适:可以交付一个没有任何依赖的文件。源码也很易读,适合看实现细节。
justincormack查看英文原文
Musl is a really nice libc, small and correct. The team are nice to work with. In particular if you want to static link something to get a completely standalone executable it is a great choice, you can ship a file with no dependencies. The source code is really easy to read if you want to see how things are implemented.
说明文章比较对象,并区分桌面与嵌入式常见 libc。
澄清一下:文章比较的是多种系统 libc 实现。桌面最常见的是 eglibc;uClibc 常见于 µClinux 这类嵌入式 Linux。历史上 eglibc 是面向嵌入式的 glibc 变体,但最终又被 glibc 取代。
yoha查看英文原文
To make it clearer: the article compares several implementations of libc for systems. On a desktop, the most common one is eglibc. uClibc is the implementation you will find on µClinux, a common version of Linux for embedded systems. Note: historically, eglibc is a variant of glibc for embedded systems (Embedded GNU libc) but finally replaced it
musl 开发者 R.. 的底层 C 回答质量很高,值得关注。
musl 的一位开发者也是 StackOverflow 上顶尖的答主之一(ID 为 “R..”)。不出所料,他主要回答底层 C 问题,回答总是很周到,值得一读(如果你关心这些细节)。
stephencanon查看英文原文
One of the musl devs is also one of the absolute best StackOverflow posters (as “R..”). Unsurprisingly, he mainly answers low-level C questions; his responses are always thoughtful and well worth reading (if you’re interested in such details).
历次讨论
同类还值得读
TTY 揭秘(2008)
The TTY demystified (2008)
经典文章深入剖析了 Unix/Linux 中 TTY 子系统的工作原理,包括线路规程、终端驱动、信号与控制字符等机制。
系统与基础设施上首页 11 次 · 2009–2025linusakesson.net编辑精选为什么 GNU grep 这么快
Why GNU grep is Fast
FreeBSD 邮件列表上一篇广为流传的帖子,解释 GNU grep 为什么快:核心在于 Boyer-Moore 字符串搜索算法配合精心优化的内部循环和 I/O,让程序在搜索时“…
系统与基础设施上首页 9 次 · 2010–2022lists.freebsd.orgXplain:为普通人讲解 X11
Xplain – Explaining X11 for the rest of us
《Xplain》是作者(HN 用户 Jasper_)写的一系列 X11 长文,用他在浏览器中重建的 X11 绘图模型做交互演示,讲解 X11 的绘图模型与窗口系统设计。
系统与基础设施上首页 6 次 · 2013–2020magcius.github.io编辑精选旋风教程:为 Linux 创建极小 ELF 可执行文件(1999)
A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux (1999)
breadbox 写于 1999 年的经典教程,主题是如何为 Linux 手工构造并裁剪出体积极小的 ELF 可执行文件。
系统与基础设施上首页 6 次 · 2007–2025muppetlabs.comPostgreSQL 内部原理
The internals of PostgreSQL
《The Internals of PostgreSQL》是一本免费在线书籍,系统讲解 PostgreSQL 的内部实现,包括查询处理、并发控制、WAL、缓冲区管理等核心机制。
系统与基础设施上首页 5 次 · 2017–2025interdb.jp编辑精选