# Alternative libc



## kolbycrouch (Jul 21, 2013)

Hello, I've been working on a small project for myself lately, a distro, using the freebsd FreeBSD kernel, and libc, with GNU's userland and toolchain, and to build the entire OS statically linked. I got all of this done, and even have several self-contained packages, such as X, and GNOME 3, which don't depend on any base userland libraries except for the dynamic loader. 

My biggest problem is that while experimenting with small static Linux kernels, I could use libraries like musl or diet, to get most of the GNU tools <100 KB, and several "written from scratch" replacement tools compiled statically at 2-4 KB, which is so much smaller than freebsd FreeBSD's libc. 

These libraries are inefficient for linking against complex packages like X/DEs Firefox etc, so the system libc is great for that, but makes the base userland far more bloated than what is necessary. Are there any other libc's for freebsd FreeBSD? Even very minimal ones? I have made patches to diet and musl, but I'm not sure If I can really port either of them to freebsd FreeBSD myself, as I'm not sure how "specific" some of the linuxisms are in them.


----------



## xibo (Jul 25, 2013)

I'm not sure what "bloat" is supposed to be here. Any fully-static-linked GNOME3 binary image will require considerably more memory and also time (to page in/out) than its shared library using counterpart since we have context sharing and on-demand loading for binary images (Linux also has) while we don't have system memory deduplication at all (Linux has, but it comes at a considerable performance hit while also requiring some extra memory) and only limited swap space deduplication (using swap on a deduped ZFS).

That said, OpenBSD is more "keep it to the minimum" than FreeBSD, which includes the libc of course.

If it comes to security, using a different libc is rather counterproductive, as limiting your own functionality won't increase it, while using less often used (and therefore less on-field-tested and less attacked) code likely decreases it.


----------



## kolbycrouch (Jul 29, 2013)

I would not link GNOME 3 statically, for shared linking freebsd FreeBSD's libc is fine, but for tiny programs, a tiny libc would be nice.


----------

