Hacker News new | past | comments | ask | show | jobs | submit login
OpenWrt switches to musl by default, replacing uClibc (gmane.org)
65 points by tomkwok on July 24, 2015 | hide | past | favorite | 21 comments

For the uninitiated, these are libc libraries for embedded systems (alternatives to glibc).



I wouldn't say that musl is particularly aimed at embedded stuff, simply that its small enough to fit most times. It is a full featured, fast C library.

Its also useful for creating statically linked executables, which is usually not possible with glibc if you use certain functions (getaddrinfo?).

I always thought you could statically link glibc - but your executable will be huge as it needs to pull in the entire plus extras.

Regardless - I'm glad I'm not the only one who is concerned about binary sizes.

IME you can statically link glibc, but your statically linked binary will still call ld.so.

The NSS stuff? And something else?

There's some specific things that are supposed to be modular library-wise.

I think you usually get a warning at link-time if you try to statically link GCC and use a function that requires matching libc version at runtime, getaddrinfo was the one I remembered but there are certainly more functions like that:

  x.c:(.text+0x85): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Indeed, musl is more about correctness/standards compliance and robustness than targeting any specific platforms (provided it's Linux).

Well there are some non Linux ports too now - Midipix for Windows, and some bare metal implementations.

> I wouldn't say that musl is particularly aimed at embedded stuff, simply that its small enough to fit most times.

Maybe it's not particularly aimed at embedded stuff, but it sure does fit well. I've used it in 3 embedded projects recently, with great results.

The only issue I've run into when trying to use musl is there are a lot of softwares out there that expect glibc, and refuse to run without (even though it probably would work). The Oracle JDK/JRE for ARM is an example, you must compile the OpenJDK from scratch to get it to use musl.

Otherwise, it's a fantastic libc. It's fast to compile, it's tiny in size, and is feature-complete enough for most of my purposes.

Rust also has experimental support for MUSL as of April:


musl has been getting quite a lot of traction recently. It's been added to the last stable crosstool-ng toolchain builder as well.

Does anyone know why they switched?

Faster, neater, smaller, etc?

it's also handy to make statically linked systems/executables; sometime for very small applications, you mostly need the kernel, a small busybox and ONE executable; you can make really small 'distros' like that, especially when linked with LTO.

I've been wondering, is there a good package manager for busybox-based distros? It would be nice to have a tiny system by default but be able to easily install other packages when necessary, for debugging or whatever.

Well, as a matter of fact, OpenWrt is probably the smallest you will get with a 'package manager'. It's really quite well made for that purpose. They have 'package install', they have 'full upgrade' and they also have an overlay filesystem to make changes to what is technically a read only system....

Personally, I prefer a tiny, very compact ROM style filesystem; if I need a package, I just rebuild it with it, and reboot.

I'm the author of minifs: https://github.com/buserror/minifs that is made to do just that.

However, we're reaching the point where the kernel is so full of crud that it is in itself the bloatware, and far worse than the userland :-(

I'm rather fond of Alpine Linux (https://www.alpinelinux.org/), but echoing buserror, I doubt it's as small as OpenWrt.

I wished it's in Openwrt's CC release, but anyway it's great news indeed.

Can someone who knows more about musl tell us about the state of automated testing for it?

It's great that gmane displays monospaced text big enough so you don't need a microscope to read it.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact