Documentation forthe GNU C Libraryis online, as is documentation for mostGNU software. It can also be accessed by runninginfo libc orman libc, or by looking at/usr/share/doc/glibc/,or similar directories on your system. A brief summary is available byrunning info libc.
The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. It is a wrapper around the system calls of the Linux kernel for application use. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s by the Free Software Foundation (FSF) for the GNU operating system.
Released under the GNU Lesser General Public License,[3] glibc is free software. The GNU C Library project provides the core libraries for the GNU system, as well as many systems that use Linux as the kernel. These libraries provide critical APIs including ISO C11, POSIX.1-2008, BSD, OS-specific APIs and more. These APIs include such foundational facilities as open, read, write, malloc, printf, getaddrinfo, dlopen, pthread_create, crypt, login, exit and more.
The glibc project was initially written mostly by Roland McGrath, working for the Free Software Foundation (FSF) in the summer of 1987 as a teenager.[10] In February 1988, FSF described glibc as having nearly completed the functionality required by ANSI C.[11] By 1992, it had the ANSI C-1989 and POSIX.1-1990 functions implemented and work was under way on POSIX.2.[12] In September 1995 Ulrich Drepper made his first contribution to the glibc and by 1997 most commits were made by him. Drepper held the maintainership position for many years and until 2012 accumulated 63% of all commits to the project.[13]
In 2010, a licensing issue was resolved which was caused by the Sun RPC implementation in glibc that was not GPL compatible. It was fixed by re-licensing the Sun RPC components under the BSD license.[14][15]
In July 2017, 30 years after he started glibc, Roland McGrath announced his departure, "declaring myself maintainer emeritus and withdrawing from direct involvement in the project. These past several months, if not the last few years, have proven that you don't need me anymore".[10]
In 1994, the developers of the Linux kernel forked glibc. Their fork, "Linux libc", was maintained separately until around 1998. Because the copyright attribution was insufficient, changes could not be merged back to the GNU Libc.[19] When the FSF released glibc 2.0 in January 1997, the kernel developers discontinued Linux libc due to glibc 2.0's superior compliance with POSIX standards.[20] glibc 2.0 also had better internationalisation and more in-depth translation, IPv6 capability, 64-bit data access, facilities for multithreaded applications, future version compatibility, and the code was more portable.[21] The last-used version of Linux libc used the internal name (soname) .mw-parser-output .monospacedfont-family:monospace,monospacelibc.so.5. Following on from this, glibc 2.x on Linux uses the soname libc.so.6[22][better source needed]
In 2009, Debian and a number of derivatives switched from glibc to the variant[24] eglibc.[25] Eglibc was supported by a consortium consisting of Freescale, MIPS, MontaVista and Wind River.[26] It contained changes that made it more suitable for embedded usage and had added support for architectures that were not supported by glibc, such as the PowerPC e500. The code of eglibc was merged back into glibc at version 2.20.[27] Since 2014, eglibc is discontinued. The Yocto Project and Debian also moved back to glibc since the release of Debian Jessie.[28]
glibc provides the functionality required by the Single UNIX Specification, POSIX (1c, 1d, and 1j) and some of the functionality required by ISO C11, ISO C99, Berkeley Unix (BSD) interfaces, the System V Interface Definition (SVID) and the X/Open Portability Guide (XPG), Issue 4.2, with all extensions common to XSI (X/Open System Interface) compliant systems along with all X/Open UNIX extensions.
glibc is used in systems that run many different kernels and different hardware architectures. Its most common use is in systems using the Linux kernel on x86 hardware, however, officially supported hardware[38] includes: ARM, ARC, C-SKY, DEC Alpha, IA-64, Motorola m68k, MicroBlaze, MIPS, Nios II, PA-RISC, PowerPC, RISC-V, s390, SPARC, and x86 (old versions support TILE). It officially supports the Hurd and Linux kernels. Additionally, there are heavily patched versions that run on the kernels of FreeBSD and NetBSD (from which Debian GNU/kFreeBSD and Debian GNU/NetBSD systems are built, respectively), as well as a forked-version of OpenSolaris.[39] It is also used (in an edited form) and named libroot.so in BeOS and Haiku.[40]
glibc has been criticized as being "bloated" and slower than other libraries in the past, e.g. by Linus Torvalds[41] and embedded Linux programmers. For this reason, several alternative C standard libraries have been created which emphasize a smaller footprint. However, many small-device projects use GNU libc over the smaller alternatives because of its application support, standards compliance, and completeness. Examples include Openmoko[42] and Familiar Linux for iPaq handhelds (when using the GPE display software).[43]
glibc does not implement bounds-checking interfaces defined in C11 and did not implement strlcpy and strlcat[44][45] until 2023 on the grounds that "in practice these functions can cause trouble, as their intended use encourages silent data truncation, adds complexity and inefficiency, and does not prevent all buffer overruns in the destinations."[46] The FAQ pointed out that the bounds-checking interfaces were optional in the ISO standard and that snprintf was available as an alternative.[46]
There are compatibility layers ("shims") to allow programs written for other ecosystems to run on glibc interface offering systems. These include libhybris, a compatibility layer for Android's Bionic, and Wine, which can be seen as a compatibility layer from Windows APIs to glibc and other native APIs available on Unix-like systems.
I need to use an alternate glibc version, newer than the one installed on my system (2.18 vs 2.15). Several related issues are coveredhere and here. The specific question I'm asking here is the following:
I downloaded glibc-2.18 and built it at /opt/glibc-2.18. By default, the file /opt/glibc-2.18/etc/ld.so.conf is missing. I created it, and updated the library cache of the new glibc as follows. I emphasize that: the new libc is found before the old libc:
With either executable, specifying LD_LIBRARY_PATH=/opt/glibc-2.18/lib makes it work. However, my question here is why that is still needed, given that the path of the new ld is configured at the beginning to pick up the new libc ahead of the old libc.
When glibc is configured with nothing other than --prefix, it builds by default with an ABI version smaller(!!) (in my case, 2.6.16) than the default on the system (2.6.24). So libc-2.18 has ABI version smaller than libc-2.15.
Configuring glibc with --enable-kernel=2.6.24 causes it to use the same ABI version as the system, which in turn fixes the resolution issues in the question statement, without the need for an explicit --rpath or LD_LIBRARY_PATH.
2) POSIX standard library. The "userland" glue of system calls. (open(),read() etc. Actually glibc does not "implement" system calls. kernel does it. But glibc provides the user land interface to the services provided by kernel so that user application can use a system call just like a ordinary function.
There are several implementations of the standard. Glibc is the implementation that most Linuxes use, but there are others. Glibc also contains (as Aftnix states) the glue functions which set up the scene for jumps into the kernel (also known as system calls). So many of glibc's 'functions' don't do the actual work but only delegate to the kernel.
The glibc package contains standard libraries which are used by multiple programs on the system. In order to save disk space and memory, as well as to make upgrading easier, common system code iskept in one place and shared between programs. This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function. The glibc package also contains national language (locale) support.
This isn't the first time, but an update to the glibc and lib32-glibc packages have broken the EAC compatibility of Steam games with Proton. More info on the linux gaming sub here. (It is version 2.38 that is causing issue.)
I typically do not do this, but seeing as it's a game-breaking bug, I chose to downgrade the packages using this method, and wait it out. Here's what I did in case someone else can use it for a reference on how to downgrade. Specifically, I am downgrading glibc lib32-glibc gcc gcc-libs lib32-gcc-libs (all required as dependencies) to their immediate previous versions.
I was recently trying out compiling swift on windows, and I found that Glibc was not something that could be imported, or at least not without some extra doing. I was trying to use the sleep() function that glibc provides.
So, there may be two causes for this. Either problems with the signature or a real corrupted package. By setting SigLevel to Never I have ruled out the first one. So my glibc package seems to be corrupted on every retry O.o.
After many experiments I tried to untar the package, which did not work (Unexpected EOF so it seemed corrupted). However, the same package (with same sha256 checksum) could be extracted on my other server. This made me reinstall "tar". After that, I could untar the package and I could also upgrade glibc by just using pacman.
(to be clear: it is unsafe to ship these executables to systems that don't have exactly the same glibc, as glibc will be dynamically loading nss modules internally and there might be ABI conflicts, even silent crashy ones, although this likely only matters if you do DNS lookups)
df19127ead