diet libc

from Wikipedia, the free encyclopedia
diet libc
Basic data

developer Felix von Leitner
Current  version 0.34
(September 24, 2018)
operating system Linux (architectures: x86, ARM, SPARC, Alpha, PowerPC, MIPS, HPPA, S / 390)
programming language C.
category Runtime
library Standard library
License GPLv2

diet libc ( English diet ' diet ') is a C standard library for Linux operating systems. Diet libc is intended to make it possible to create particularly compact binary files for Linux . The library was developed by Felix von Leitner with the help of over 100 volunteers. The library is subject to the GPL license, version 2, but commercial licenses are also available from the author.

The library was presented to the professional public in lectures by Leitners at the 8th International Linux Congress 2001 and the Chemnitz Linux Days 2002.

Range of functions

A C standard library typically contains around 200 functions that are required by many programs written in C. The glibc normally used under Linux goes well beyond this range of functions and also consists of a few larger code blocks that have to be loaded by a program that uses only one of these functions.

The diet libc, on the other hand, has been completely rewritten and is limited to the most important functions of the standard C library; the program code is also optimized for speed and small size. The name alludes to the primary objective of a lean libc , which leads to a size of the program package of currently almost 420 kB compared to around 4.5 MB for glibc. The entire library has a modular structure so that only the functions that are actually used in the program have to be loaded. Compared to glibc, this gives a clear gain in speed and the compiled programs are much smaller. A complete replacement of the glibc is not yet possible due to the size of this, although further functions are added with each new version of the diet libc. In addition, there are a number of patches with which command line programs and servers in particular can be adapted to diet libc. Programs also generally have to be recompiled in order to use the diet libc.

Development history

The beginnings of the development of the diet libc are difficult to understand because the oldest versions are undated; the oldest version still available to the public is 0.7 from January 16, 2001, the changelogs go back to version 0.5.9 . The library is now available in version 0.34 , which was released on September 24, 2018.


The diet libc is mainly used for free software in the area of embedded systems . The GPL does not allow linking of proprietary programs, so uClibc , which is under the LGPL , is preferred here. In addition, the uClibc supports even more architectures, but like the normal glibc is not modular. Both libraries are also supported by T2 SDE .

In contrast to the larger uClibc , the diet libc can also be used for particularly compact Linux distributions , as is the case, for example, with the DietLinux project, which has now apparently fallen asleep. The libc is also used in the initrd or initramfs systems of various conventional Linux distributions used during the boot process for reasons of space and speed.

The libc is mainly used for static links, i.e. the case in which the required functions of the library are contained in the program itself, instead of having to be available as a further file on the system. The choice of diet libc and, to a lesser extent, the static linking itself saves storage space. This solution is also preferred by the author, dynamic linking is only supported under i386 and with newer versions under ARM .

See also

Individual evidence

  1. .
  2. ^ Diet libc - credits
  3. a b c d Karim Yaghmour: Building embedded Linux systems . O'Reilly Media, Inc., 2003, pp. 139ff
  4. Lecture of November 28, 2001
  5. ^ Diet libc: a new libc for Linux . Lecture from March 10, 2003
  6. dietlibc in Ubuntu Packages
  7. Ubuntu - Information about package libc6
  8. a b Remove quickly . Linux magazine 2006/07
  9. Some thoughts about codesize
  10. Series of patches to make some Linux programs compatible with libc
  11. Another patch archive ( Memento from September 10, 2005 in the Internet Archive )
  12. ^ Diet libc - old news
  13. T2 SDE Embedded