A Variety of C Standard Libraries



Many C Standard Libraries are available for Linux. A "C Standard Library" is a set of programming libraries that follow the ANSI C Standard. The C Standard Library may also be called the "ISO C Library" due to its standardization. Even though the libraries are standardized, variations may exist to support special needs as discussed in this article.

C Standard Libraries offer ready-made functions and other code. For instance, the math library offers functions for various mathematics such as cosine, square root, etc. When using a standard library, the functions are expected to perform the same task, although they may act differently. For instance, the tangent math function (tan) will return the same tangent of a particular number no matter which C Standard Library is used. However, the internal code will run differently depending on the library's goal.

The C POSIX Library is a library specification specifically for POSIX systems and functions.

Linux applications typically use the GNU C Library (glibc). This is a C Standard Library designed for the GNU userland (as seen in GNU/Linux and GNU Hurd). This library follows the POSIX and Unix standards as well as parts of other standards (such as BSD and the System V Interface Definition). C++ is also supported by glibc. Embedded GLIBC (EGLIBC) is a discontinued project that was going to make a variant of glibc for embedded Linux systems.

uClibc (or μClibc) is a C Standard Library designed for embedded Linux systems and mobile Linux systems. Most Linux applications can be ported from glibc to uClibc by recompiling the software with uClibc instead of glibc. Although uClibc is popular in special Linux systems, it can also be used in the Contiki operating system (http://www.contiki-os.org/), if uClibc is compiled with it instead of other C Standard Libraries. Also, Openmoko is a mobile Linux distro that uses uClibc (http://wiki.openmoko.org).

NOTE: Contiki is not a Linux distro.

uClibc++ (or μClibc++) is a C++ Standard Library form of uClibc.

Bionic is a C Standard Library used in Android systems. Bionic is similar to libc which is the C Standard Library used by BSD systems. Bionic is developed by Google and others and is licensed under the 3-clause BSD License. Bionic is perfect for Android due to its small size. It is smaller than glibc and uclibc. In addition, the library is specifically designed for CPUs with low clock speeds as seen in many Android phones. Like anything, Bionic is not perfect. It does not support wide characters or C++ exception handling. Glibc (GNU C Library) based Linux distros can use Bionic-based applications thanks to the Hybris (libhybris) compatibility layer. Hybris works by converting Bionic syscalls to glibc syscalls.

dietlibc is a cross-platform C Standard Library that is an alternative to uClibc. The library is very lightweight and may not contain all of the functions offered by uClibc. DietLinux is a discontinued distro that was based on dietlibc. dietlibc is licensed under the GPL license.

musl is a C Standard Library designed for embedded Linux systems and optimized for static linking. The library is licensed under the MIT License and made by Rich Felker. musl is fast, lightweight, and POSIX compliant.

Newlib is a cross-platform C Standard Library for embedded systems. Newlib is commonly used on homebrew software for various gaming systems such as the Gameboy Advanced, Sony' PlayStation Portable (PSP), the Nintendo DS, Nintendo's Wii, and Nintendo's GameCube. Newlib is made and maintained by RedHat.

klibc is a small C Standard Library designed by Hans Peter Anvin for the Linux start-up process (bootstrap). klibc is commonly used in the initial RAM file systems of Debian and Ubuntu. klibc may also be found in nfsmount, the Dash shell, cpio, and other Unix utilities.

NOTE: This Hans Peter Anvin is the same person that made the SYSLinux bootloader.

Further Reading
If you would like to see more content from me and be notified of released articles, follow me on Google+ ( https://plus.google.com/ DevynJohnson/ ) or Twitter ( https://twitter.com/DevynCJohnson ). Also, follow Linux.org's Google+ account ( https://plus.google.com/u/0/111301317258533720785 ).


  • slide.jpg
    29 KB · Views: 1,314
Last edited:

Members online