site  contact  subhomenews

Goodbye uClibc-ng

September 09, 2018 — BarryK

I have used uClibc over the years, to created small static executables. It is a competitor to musl, dietlibc and newlib. The offical uClibc project died, and got forked as uClibc-ng. At that time, just about everybody moved to musl -- Landley dropped it from Aboriginal Linux, OpenEmbeded/Yocto dropped it -- Buildroot continue to offer a choice of glibc, uClibc or musl, ditto OpenADK.

I have a fork of Landley Aboriginal, the last that supports uClibc:

Over the last few days, I have been playing with creating a native toolchain based on uClibc-ng. I was checking out various projects, and discovered 'pts-tcc', part of which has a utility that is a wrapper around gcc, enabling to compile with uClibc library, rather then glibc. This works like the 'diet' utility in dietlibc, that is, 'diet' is a wrapper for gcc, to link with the diet libraries.

I used uClibc-ng version 1.0.30, the latest. I posted to the 'pts-tcc' project about a problem:

However, the wrapper utility 'i386-uclibc-gcc' works. I even compiled it for aarch64. Using it, I compiled a static "Hello World", which after stripping was 262KB. Similar size for aarch64. Oh dear, it should be down under 20KB -- that is the main reason for using this library, to create small static executables. So, posted a report:

...oh dear, another person reporting 107K and going up, this is not good!

I might try the most recent version from the original uClibc project, for comparison.

Yes, tested with the original uClibc, plus some patches, got a stripped hello world 254KB. Hmmm, investigated the .config file, found the main reason for the bloat, posted here:

Now down to 86K, still big but a huge improvement. Will study the .config file some more. And will go back to uclibc-ng, test that.

Tags: linux