FREQUENTLY Asked Questions About The GNU C LibraryFrequently Asked Questions About The GNU C LIBRARY
.................
The GNU C library is very complex The installation process has not been completely automated;. There are too many variables You can do substantial damage to your system by installing the library incorrectly Make sure you understand what you are undertaking before you begin...
If you have any quest questions you think soed, please let me know.
--Drepper@redhat.com
Compiling Glibc
1.1. What systems does the GNU C LIBRARY RUN?
1.2. What Compiler Do I NEED TO Build GNU LIBC?
1.3. WHEN I TRY TO Compile Glibc I get online? What's wrong?
1.4. Do I NEED A SPECIAL Linker or asker?
1.5. Which compiler limited?
1.6. Which Tools SHOULD I Use for ARM?
1.7. Do I NEED SOME MORE THINGS TO COMPILE THE GNU C LIBRARY?
1.8. What version of the linux kernel headers shop be used?
1.9. The Compiler HANGS While Building Iconvdata Modules. What's Wrong?
1.10. WHEN I Run `NM --U Libc.so 'on the productionD library I STILL FIND UNRESOLVED SYMBOLS. Can this be ok?
1.11. What Are these `add-ons'?
1.12. My xxx kernel Emulates a floating-point coprocessor for me. SHOULD I ENABLE --WITH-FP?
1.13. WHEN Compiling GNU Libc I Get Lots of Errors Saying Functions in Glibc Are Duplicated in Libgcc.
1.14. Why do I Get Messages About Missing Thread Functions WHEN I Use librt? I don't even use threads.
1.15. What's the problem with configure --enable-omitfp?
1.16. I get failures during `make check '. What Should I do? 1.17. What is symbol versioning good for? Do I need it?
1.18. How Can I Compile ON MY FAST IX86 MACHINE A WORKING LIBC for My SLOW I386? After Installing Libc, Programs Abort with "Illegal Instruction".
1.19. `Make 'Complains About a Missing DLFCN / LIBDL.SO WHEN Building Malloc / libmemprof.so. How Can I FIX this?
1.20. Which Tools SHOULD I Use for MIPS?
1.21. Which compiler limited??
2. Installation and Configuration Issues
2.1. CAN I RESACE THE LIBC ON MY Linux SYSTEM WITH GNU LIBC?
2.2. How do I configure gnu Libc SO That The ESSENTIAL LIBRARIES LIKE LIBC.SO Go INTO / LIB AND THE OTHER INTO / USR / LIB?
2.3. How SHOULD I AVOID DAMAGING MY SYSTEM WHEN I INSTALL GNU LIBC?
2.4. Do I NEED TO USE GNU CC To Compile Programs That Will Use The GNU C LIBRARY?
2.5. WHEN LINKING WITH NEW LIBC I GET Unresolved Symbols `Crypt 'and` setkey'. Why Aren 'There Functions in the libc anymore?
2.6. WHEN I Use GNU Libc On My Linux System by Linking Against The Libc.so Which Comes with Glibc All I Get Is A Core DUMP.
2.7. Looking Through the shared libc file i haven't Found the functions `stat ',` lstat', `fstat ', and` mknod' and while linking on my linux system i get error message. How is this support to work?
2.8. When I Run An Executable on One System Which i Compiled on Another, I get Dynamic Linker Errors. Both Systems Have The Same Version of Glibc Installed. What's Wrong?
2.9. How can I Compile GCC 2.7.2.1 from the GCC SOURCE CODE USING GLIBC 2.x?
. 2.10 The `gencat 'utility can not process the catalog sources which were used on my Linux libc5 based system Why 2.11 Programs using libc have their messages translated, but other behavior is not localized (e.g. collating order);.?. Why?
2. I have set up /etc/nis.conf, AND the Linux libc 5 with nys works Great. But The Glibc Nis Doesn't Seem To Work.
2.13. I Have Killed Ypbind to Stop Using NIS, But Glibc Continues Using NIS.
2.14. Under Linux / Alpha, I Always Get "Do_ypCall: CLNT_CALL: RPC: Unable to remove; errno = connection refused" When Using NIS.
2.15. After Installing Glibc Name Resolving Doesn't Work Properly.
2.16. How do i create the databases for nss?
2.17. I Have / usr / include / net and / usr / include / scsi as symlinks into my linux source tree. Is this WRONG?
2.18. Programs like `logname ',` top', `uPtime '` Users', `w 'and` WHO', Show Inforrect Information About The (Number of) Users on my system. Why?
2.19. After Upgrading to Glibc 2.1 with Symbol Versioning I get Errors About undefined Symbols. What WRONG?
2.20. When i start the program xxx after Upgrading the library I get xxx: symbol `_sys_errlist 'Has Different Size In Shared Object, Consider Re-Linking Why? What Should I do?
2.21. What Do I NEED FOR C DEVELOPMENT?
2.22. Even staticly linked programs Need Some Shared Libraries Which is not acceptable for me. What CAN I do?
2.23. I Just Upgraded My Linux System To Glibc and Now I Get Errors WHENEVER I TRY To Link Any Program.
2.24. WHEN I use nscd the machine freezes.
2.25. I Need Lots of Open Files. What do i Have to do?
2.26. How do i get the Same Behavior on Parsing / etc / passwd and / etc / group as I have used ilbc5? 2.07. What needned from Glibc 2.0 to glibc 2.1?
2.28. Why is extracting files via tar so solution?
2.29. Compiling Programs I get Parse Errors in libio.h (E.G. "Parse Error Before` _io_seekoff '"). How Should I FIX THIS?
2.30. After Upgrading to Glibc 2.1, Libraries That Wepace Compiled Against Glibc 2.0.x Don't Work Anymore.
2.31. What happened to the Berkeley DB Libraries? Can I STILL USE DB IN /ETC/NSSWITCH.CONF?
2.32. What hass do be done when Upgrading to Glibc 2.2?
2.33. The Makefiles Want to Do a cvs.
2.34. When Compiling C Programs, I Get a Compilation Error In streambuf.h.
2.35. When Recompiling GCC, I Get Compilation Errors in LibIO.
2.36. Why Shall Glibc Never Get Installed On GNU / Linux Systems IN / USR / LOCAL?
2.37. When Recompiling GCC, I Get CompiLation Errors in LibSTDC .
3. Source and Binary Incompatibilities, and what to do about them
3.1. I Expect GNU Libc To BE 100% Source Code Compatible with the old linux based gnu libc. Why isn't it like this?
3.2. Why does getlogin () Always Return Null On My Linux Box?
3.3. WHERE ARE THE DST_ * Constants Found in
3.4. The prototypes for `connect ',` accept', `getsockopt ',` setsockopt', `getsockname ',` getpeername', `send ',` sendto', and `recvfrom 'are different in GNU libc from any other system I SAW. This is a bug, isn't it?
3.5. On Linux I've Got Problems with The Declarations in Linux Kernel Headers.
3.6. I don't include any The Compiler STI TYPES in The Kernel Headers.3.7. Why Don't sign INTERRUPT SYSTEM CALLS ANYMORE?
3.8. I've Got Errors Compiling Code That Uses Certain String Functions. Why?
3.9. I get compiler message "Initializer Element Not Constant" with stdin / stdout / stderr. Why?
3.10. I can't compile with gcc --traditional (or -traditional-cpp). Why?
3.11. I get Some Errors with `GCC -ANSI '. Isn't Glibc ANSI Compatible?
3.12. I can't Access Some functions Anymore. Nm Shows That They Do Exist But Linking Fails Nevertheless.
3.13. WHEN USING THE DB-2 Library Which Comes with glibc IS USED IN The Perl DB Modules The Testsuite Is Not Passed. This Did NOT HAPPEN WITH DB-1, GDBM, or NDBM.
3.14. The Pow () inline function I get1 including
3.15. The sys / sem.h file lacks the definition of `union semun '.
3.16. Why has
3.17. I get floods of warnings when i use -wconversion and incdude
3.18. After Upgrading to Glibc 2.1, I Receive Errors About Unresolved Symbols, Like `_DL_Initial_Searchlist 'and Can not Execute Any Binaries. What Wrent Wrong?
3.19. Bonnie Reports That Char I / O with Glibc 2 Is Much Slower Than With Libc5. What Can BE DONE?
3.20. Programs Compiled with Glibc 2.1 Can't Read DB Files Made with Glibc 2.0. What Has Changed That Programs Like RPM Break?
3.21. AutoConf's AC_CHECK_FUNC MACRO Reports That A Function Exists, But athen I try to use it it, it always returns -1 and sets errno to enosys.
3.22. My Program Segfaults When i call fclose () on the file * returned from setmntent (). IS this a glibc bug? 3.23. I get "undefined reason to` atexit '"
4. Miscellaneous
4.1. After i change configure.in I get `AutoConf Version X.y. or higher is required for this script '. What can I do?
4.2. When I try to compile which USES IPv6 Headers and definitions on my linux 2.x.y system i am in trouble. Nothing Seems to work.
4.3. When I set the timezone by setting the tz environment variable to est5edt things go wrong time from this information.
4.4. What Other Sources of Documentation About Glibc Are Available?
4.5. The Timezone String for Sydney / Australia Is Wrong Since Even Daylight Saving Time Is in Effect The Timezone String IS EST.
4.6. I'VE BUILD MAKE 3.77 Against Glibc 2.1 and now make Gets Segmentation Faults.
4.7. Why do so many programs Using Math Functions Fail on My AlphaStation?
4.8. The Conversion Table for Character Set Xx Does Not Match with what i expect.
4.9. How can I find out Which Version of Glibc i am usning in the moment?
4.10. Context Switching with setContext () DOES NOT WORK from Withnin Signal Handlers.
Compiling Glibc
1.1. What systems does the GNU C Library run on? {UD} This is difficult to answer. The file `README 'lists the architectures GNU libc was known to run on * at some time *. This does not mean that it still can BE Compiled and Run on Them Now.
The Systems Glibc Is Known To Work ON AS of this Release, And Most Probably in The Future, Are:
* - * - GNU GNU HURD
i [3456] 86- * - linux-gnu Linux-2.x on intel
M68k - * - linux-gnu Linux-2.x on motorola 680x0
Alpha * - * - linux-gnu Linux-2.x on Dec alpha
PowerPC - * - linux-gnu Linux and mklinux on powerpc systemspowerpc64 - * - linux-gnu Linux-2.4 on 64-bit powerPC systems
Sparc - * - linux-gnu Linux-2.x on SPARC
Sparc64 - * - linux-gnu Linux-2.x on UltraSparc
ARM - * - NONE ARM Standalone Systems
ARM - * - Linux Linux-2.x on ARM
ARM - * - linuxaout Linux-2.x on arm Using A.out Binaries
MIPS * - * - Linux-gnu Linux-2.x on MIPS
IA64 - * - linux-gnu Linux-2.x on IA64
S390 - * - linux-gnu Linux-2.x on IBM S / 390
S390X - * - Linux-gnu Linux-2.x on IBM S / 390 64-bit
Cris - * - linux-gnu Linux-2.4 on cris
Ports to other Linux platforms are in development, and may in fact work already, but no one has sent us success reports for them. Currently no ports to other operating systems are underway, although a few people have expressed interest.
If you have a system not listed above (or in the `readme 'file) and you are realinted in porting it, contact
1.2. What compiler do I need to build gnu libc? {Ud} you must use gnu cc to compile gnu libc. A Lot of Extensions of GNU cc Are Used to increase portability and speed.
GNU CC Is Found, Like All Other GNU Packages, ON
ftp://ftp.gnu.org/pub/gnu
And The MiRrror Sites. ftp.gnu.org is always overloaded, SO try to find a local mirror first.
You should always try to use the latest official release. Older versions may not have all the features GNU libc requires. The current releases of gcc (3.2 or newer) should work with the GNU C library (for MIPS see question 1.20).
Please Note That GCC 2.95 and 2.95.x Cannot Compile Glibc On Alpha Due To Problems In The Complex Float Support.
1.3. When I try to compile glibc I get only error messages. What's wrong? {UD} You definitely need GNU make to build GNU libc. No other make program has the needed functionality.We recommend version GNU make version 3.79 or newer. Older Versions Have Bugs and / OR Are Missing Features.
1.4. Do I need a special linker or assembler? {ZW} If you want a shared library, you need a linker and assembler that understand all the features of ELF, including weak and versioned symbols. The static library can be compiled with less featureful Tools, But Lacks Key Features Such as NSS.
For Linux or Hurd, You Want Binutils 2.13 or Higher. Test and Found Reliable. Other Versions May Work But We don't Recommend Them, Especially NOT WHEN C is involved.
Other OPERATING SYSTE HAVE The Necessary Feen Ported to the the next.
1.5. Which compiler baby {} removed. Does not Apply Anymore.
1.6. Which Tools SHOULD I Use for arm? {} Remoded. Does not Apply Anymore.
.
GNU gettext. This package contains the tools needed to construct `message catalog 'files containing translated versions of system messages. See ftp://ftp.gnu.org/pub/gnu or better any mirror site. (We distribute compiled message catalogs, but they may not be updated in patches.) Some files are built with special tools. Eg, files ending in .gperf need a `gperf 'program. The GNU version (now available in a separate package, formerly only as part of libg ) is known to work while some vendor versions do not. you should not need these tools unless you change the source files. Perl 5 is needed if you wish to test an installation of GNU libc as the primary C library. When compiling for Linux, the Header Files of the Linux Kernel Must Be Available To The Compiler AS
400MHz W / 64MB of RAM, And About 9h on a 601 @ 60MHz W / 72MB. If You Have Some More Measurements Let Me Know.1.8. What Version of The Linux Kernel Headers Should Be Used? {Aj, ud} The headers from the most recent Linux kernel should be used. The headers used while compiling the GNU C library and the kernel binary used when using the library do not need to match. The GNU C library runs without problems on kernels that are older than the kernel headers used . The other way round (compiling the GNU C library with old kernel headers and running on a recent kernel) does not necessarily work. For example you can not use new kernel features if you used old kernel headers to compile the GNU C library.
{ZW} Even if you are using a 2.0 kernel on your machine, we recommend you compile GNU libc with 2.2 kernel headers. That way you will not have to recompile libc if you ever upgrade to kernel 2.2. To tell libc which headers to Use, Give Configure the --with-headers switch (eg --with-headers = / usr / src / linux-2.2.0 / include).
Note that you must configure the 2.2 kernel if you do this, otherwise libc will be unable to find
1.9. The Compiler HANGS While Building Iconvdata Modules. What's Wrong? {} Removed. Does Not Apply Anymore.
1.10. When i Run `NM -U Libc.so 'on the production {ud} Yes, this is ok. There Can Be Several Kinds of Unresolved Symbols:
magic symbols automatically generated by the linker. These have names like __start_ * and __stop_ * symbols starting with _dl_ * come from the dynamic linker weak symbols, which need not be resolved at all (fabs for example) Generally, you should make sure you find a real program which produces errors while linking before deciding there is a problem.1.11. What are these `add-ons'? {UD} To avoid complications with export rules or external source code some optional parts of the libc are distributed as separate packages , EG, The Linuxthreads Package.
To use these packages as part of GNU libc, just unpack the tarfiles in the libc source directory and tell the configuration script about them using the --enable-add-ons option. If you give just --enable-add-ons configure tries To find all the add-on packages in your source tree. this may not work. if it doesn't, or if you want to select Only A Subset of the Add-ONS, GIVE A COMMA-SEPARATED LIST OF THE ADD-ONS To enable:
Configure --Nable-Add-Ons = LinuXThreads
For example.
Add-ons can add features (including entirely new shared libraries), override files, provide support for additional architectures, and just about anything else The existing makefiles do most of the work;. Only some few stub rules must be written to get everything running .
Most add-ons are tightly coupled to a specific GNU libc version. Please check that the add-ons work with the GNU libc. For example the linuxthreads add-on has the same numbering scheme as the libc and will in general only work with the Corresponding libc.
{AJ} With glibc 2.2 the crypt add-on and with glibc 2.1 the localedata add-on have been integrated into the normal glibc distribution, crypt and localedata are therefore not anymore add-ons.1.12. My XXX kernel emulates a floating-point Coprocessor for me. SHOULD I Enable --with-fp? {zw} an emulated fpu is Just As Good As a real one, as far as the c library is concerned. You Only Need To Say --without-fp if you markine Has No Way To Execute Floating-Point Instructions.
People who are interested in squeezing the last drop of performance out of their machine may wish to avoid the trap overhead, but this is far more trouble than it's worth: you then have to compile * everything * this way, including the compiler's internal libraries ( Libgcc.a for GNU C), Because The Calling Conventions Change.
1.13. When compiling GNU libc I get lots of errors saying functions in glibc are duplicated in libgcc. {EY} This is * exactly * the same problem that I was having. The problem was due to the fact that configure did not correctly detect That The Linker Flag - NO-WHOLE-Archive Was Supported In My Linker. in My Case IT WAS BECAUSE I HAD Run ./configure with bogus cflags, and the test failed.
ONE Thing That This Problem Is That Once This Is MISDETECTED, RUNNING Configure Again Won't fix it unless you first delete config.cache.
{UD} Starting with Glibc-2.0.3 There SHOULD BE A Better Test to Avoid Some Problems of CFLAGS IS CHECKED AT THE BEGINNINGER 'WILL BARK.
1.14. Why do I get messages about missing thread functions when I use librt? I do not even use threads. {UD} In this case you probably mixed up your installation. Librt uses threads internally and has implicit references to the thread library. Normally these references are satisfied automatically but if the thread library is not in the expected place you must tell the linker where it is When using GNU ld it works like this:. gcc -o foo foo.c -Wl, -rpath-link = / Some / other / dir -lrt
THE `/ Some / Other / Dir 'Should Contain The Thread Library.` Ld' Will Use The Given path to find the implicitly referened library while not disturbing any other link path.
1.15. What's the problem with configure --enable-omitfp? {AJ} When --enable-omitfp is set the libraries are built without frame pointers. Some compilers produce buggy code for this model and therefore we do not advise using it at The Moment.
If you use --enable-omitfp, you're on your own. If you encounter problems with a library that was build this way, we advise you to rebuild the library without --enable-omitfp. If the problem vanishes consider tracking the Problem Down and Report IT As Compiler Failure.
Since a library build with --enable-omitfp is undebuggable on Most Systems, Debuggable Libraries Are Also Built - You CAN Use the the library name.
..............
. 1.16 I get failures during `make check 'What should I do {AJ} The testsuite should compile and run cleanly on your system;.?. Every failure should be looked into Depending on the failures, you probably should not install the library at all.You should consider using the `glibcbug 'script to report the failure, providing as much detail as possible If you run a test directly, please remember to set up the environment correctly you want to test the compiled library -.. and not your Installed One. The Best Way Is To Copy The Exact Command Line Which Failed And Run The Test from The Subdirectory for this test in the source.
There Area Some Failes Which Are Not Directly Related To The GNU LIBC:
Some compilers produce buggy code. No compiler gets single precision complex numbers correct on Alpha. Otherwise, gcc-3.2 should be ok. The kernel might have bugs. For example on Linux / Alpha 2.0.34 the floating point handling has quite a number of bugs and therefore most of the test cases in the math subdirectory will fail. Linux 2.2 has fixes for the floating point support on Alpha. The Linux / SPARC kernel has also some bugs in the FPU emulation code (as of Linux 2.2.0). Other Tools Might Have Problems. For Example Bash 2.03 Gives A Segmentation Fault Running The TST-RPMATCH.SH Test Script.
1.17. What is symbol versioning good for? Do I need it? {AJ} Symbol versioning solves problems that are related to interface changes. One version of an interface might have been introduced in a previous version of the GNU C library but the interface or the semantics of the function has been changed in the meantime. for binary compatibility with the old library, a newer library needs to still have the old interface for old programs. On the other hand, new programs should use the new interface. Symbol versioning is . the solution for this problem The GNU libc version 2.1 uses symbol versioning by default if the installed binutils supports it.We do not advise building without symbol versioning, since you lose binary compatibility -! forever The binary compatibility you lose is not only against The Previous Version of The GNU Libc (Version 2.0) But Also Against All Future Versions.
1.18. How can I compile on my fast ix86 machine a working libc for my slow i386? After installing libc, programs abort with "Illegal Instruction". {AJ} glibc and gcc might generate some instructions on your machine that are not available on i386. You'Ve Got To Tell Glibc That You're configuring for i386 with adding i386 as your machine, for example:
. ../configure --prefix = / usr i386-pc-linux-gnu
And you need to Tell GCC to Only Generate i386 Code, Just Add `-mcpu = i386 '(Just -m386 Doesn't Work) to your cflags.
{UD} this applies NOT Only to the i386. Compiling on a i686 for any Older Model Will Also Fail If The Above Methods Are Not Used.
1.19. `Make 'Complains About a Missing DLFCN / Libdl.so When Building Malloc / libmemprof.so. How can I fix this? {Aj} Older make Version (<= 3.78.90) Have a bug Which Was Hidden BY A BUG in glibc (<= 2.1.2). you need to upgrade make to a newer or fixed version.After upgrading make, you should remove the file sysd-sorted in your build directory. The problem is that the broken make creates a wrong order For One List in That File. The list has to be recreated with the new make - Which happens if you remove the file.
You might Encounter this bug also in Other Situations where make scans directories. I strongly advise to upgrade your makession to 3.79 or newer.
1.20. Which Tools SHOULD I Use for Mips? {Aj} You Should Use The Current Development Version of GCC 3.2 or NEWER from CVS.
You NEED Also Recent Binutils, Anything Before and Including 2.11 Will NOT Work Correctly. Either try The Linux Binutils 2.11.90.5 from HJ Lu or The Current Development Version of Binutils from CVS.
Please Note That `make Check 'Might Fail for a Number of the Math Tests Because of problems of the fpu emulation in The Linux Kernel (The Mips FPU Doesn't Handle All Cases and Needs Help from the Kernel).
For Details Check Also My Page http://www.suse.de/~aj/glibc-mips.html.
1.21. Which Compiler SHOULD I Use for PowerPC64? {SM} You Want To Use At Least GCC 3.2 (TOGETHER WITH Right Versions of All The Other Tools, Of Course).
2. Installation and Configuration Issues
2.1. Can I replace the libc on my Linux system with GNU libc? {UD} You can not replace any existing libc for Linux with GNU libc. It is binary incompatible and therefore has a different major version. You can, however, install it alongside Your EXISTING LIBC.FOR Linux There Three Major Libc Versions:
LIBC-4 a.out libc
LIBC-5 Original ELF LIBC
LIBC-6 GNU LIBC
You can have any combination of these three installed. For more information consult documentation for shared library handling. The Makefiles of GNU libc will automatically generate the needed symbolic links which the linker will use.
2.2. How do I configure GNU libc so that the essential libraries like libc.so go into / lib and the other into / usr / lib? {UD, AJ} Like all other GNU packages GNU libc is designed to use a base directory and install all files relative to this. The default is / usr / local, because this is safe (it will not damage the system if installed there). If you wish to install GNU libc as the primary C library on your system, set the base Directory TO / USR (IE Run Configure --prefix = / usr
2.3 for details.
Some systems like Linux have a filesystem standard which makes a difference between essential libraries and others. Essential libraries are placed in / lib because this directory is required to be located on the same disk partition as /. The / usr subtree might be found on another Partition / Disk. if you configure for Linux with --prefix = / usr, the this will be done automatically.
To install the essential libraries which come with GNU libc in / lib on systems other than Linux one must explicitly request it. Autoconf has no option for this so you have to use a `configparms 'file (see the` INSTALL' file for details) IT Should Contain: Slibdir = / LIB Sysconfdir = / ETC
The First Line Specifier The Directory for The Essential Libraries, The Second Line The Directory for System Configuration Files.
2.3. How should I avoid damaging my system when I install GNU libc? {ZW} If you wish to be cautious, do not configure with --prefix = / usr. If you do not specify a prefix, glibc will be installed in / usr / local, WHERE IT WILL PROBABLY NOT BREAK Anything (IF you wish to be ceertin, set the prefix to sometying Like / usr / local / glibc2 Which is not buy for anything.)
The Dangers When Installing Glibc In / USR Are Twofold:
glibc will overwrite the headers in / usr / include. Other C libraries install a different but overlapping set of headers there, so the effect will probably be that you can not compile anything. You need to rename / usr / include out of the way before running `make install '(Do not throw it away; you will then lose the ability to compile programs against your old libc.). None of your old libraries, static or shared, can be used with a different C library major version. For shared libraries this is not a problem, because the filenames are different and the dynamic linker will enforce the restriction. But static libraries have no version information. You have to evacuate all the static libraries in / usr / lib to a safe location. The .
. 2.4 Do I need to use GNU CC to compile programs that will use the GNU C Library {ZW} In theory, no;? The linker does not care, and the headers are supposed to check for GNU CC before using its extensions to the C language.However, there are currently no ports of glibc to systems where another compiler is the default, so no one has tested the headers extensively against another compiler. you may therefore encounter difficulties. If you do, please report them as bugs.
Also, in several places GNU extensions provide large benefits in code quality. For example, the library has hand-optimized, inline assembly versions of some string functions. These can only be used with GCC. See question 3.8 for details.
2.5. WHEN LINKING WITH NEW LIBC I GET Unresolved Symbols `Crypt 'and` setKey'. Why aren '} in the libc Anymore? {} Remoded. Does Not Apply Anymore.
2.6. When I use gnu libc on my linux system by linking against the libc.so which comes with glibc all i get is a core dump. {Ud} the dynamic linker to /lib/ld-linux.so .1 unless the user specifies a - Dynamic-Linker Argument. This is the name of the libc5 Dynamic Linker, Which Does Not Work with Glibc.
FOR Casual Use of Gnu Libc You Can Just Specify To The Linker
- Dynamic-Linker = / lib / ld-linux.so.2
Which is the glibc Dynamic Linker, on Linux systems. on other systems the name is /lib/ld.so.1 .hen Linking Via GCC, You'VE Got To Add
-Wl, - Dynamic-Linker = / lib / ld-linux.so.2
To the gcc commnd line.
To change your environment to use gnu libc for compiling you need to change the `SPECS 'File of Your GCC. This file is Normal Found At
/ USR / LIB / GCC-LIB /
In this file you have to change a few things: change `ld-linux.so.1 'to` ld-linux.so.2' remove all expression `{...: - lgmon} '; there is no libgmon In Glibc Fix a Minor bug by Changing% {Pipe: -} TO% | Here is what the GCC-2.7.2 SPECS File SHOULD LOOKE WHEN GNU LIBC IS Installed AT / USR:
* ASM:% {V}% {V:% {! v: -v}}% {qy:}% {! qn: -qy}% {n}% {t}% {ym, *}% {yd , *}% {Wa, *:% *}
* ASM_FINAL:% |
* CPP:% {fpic: -d__pic__ -d__pic__}% {fpic: -d__pic__ -d__pic__}% {! m386: -d__i486__}% {pOSIX: -D_posix_source}% {pthread: -d_reeTrant}
* CC1:% {profile :-p}
* CC1PLUS:
* endfile:% {! shared: crtend.O% s}% {shared: crtends.O% s} crtn.o% s
* LINK: -M ELF_I386% {Shared: -shared}% {! shared:% {! ibcs:% {! static:% {rDynamic: -Export-Dynamic}% {! Dynamic-Linker: -dynamic-linker / lib / ld-linux.so.2}}} {static: -static}}}}
* lib:% {! shared:% {pthread: -lpthread}% {profile: -lc_p}% {! profile: -lc}}
* Libgcc: -lgcc
* StartFile:% {! Shared:% {PG: GCRT1.O% s}% {! pg:% {p: gCRT1.O% s}% {! p: {profile: GCRT1.O% s}% { ! profile: crt1.O% s}}}} crti.O% s% {! shared: crtbegin.o% s}% {shared: crtbegins.o% s}
* Switch_Need_Spaces:
* Signed_Char:% {funsigned-char: -d__char_unsigned__}
* predefines: -d__elf__ -dunix -di386 -dlinux -asystem (unix) -asystem (pOSIX) -Acpu (i386) -amachine (i386)
* Cross_Compile: 0
* Multilib:.
Things get a bit more complicated if you have GNU libc installed in some other place than / usr, ie, if you do not want to use it instead of the old libc. In this case the needed startup files and libraries are not found in the Regular Places. So The Specs File Must Tell The Compiler and Linker EXACTLY What To Use.
Version 2.7.2.3 Does and Future Versions of GCC Will Automatically Provide the Correct Specs.
2.7. Looking Through the shared libc file i haven't Found the functions `stat ',` lstat', `fstat ', and` mknod' and while linking on my linux system i get error message. How is this support to work? {RM} believe it or not, stat and lstat (and fstat, and mknod) Are supports in libc.so.6! Your problem/usr/lib/libc.so file; Note That this is a small text file now, not a symlink to libc.so.6. it Should Look Something Like this: group (libc.so.6 libc_nonshared.a)
2.8. When I run an executable on one system which I compiled on another, I get dynamic linker errors. Both systems have the same version of glibc installed. What's wrong? {ZW} Glibc on one of these systems was compiled with gcc 2.7 or 2.8, the other with egcs (any version). egcs has functions in its internal `libgcc.a 'to support exception handling with C . They are linked into any program or dynamic library compiled with egcs, whether it needs them or not. Dynamic .
When you link your program, it resolves its references to the exception functions to the ones exported accidentally by libc.so. That works fine as long as libc has those functions. On the other system, libc does not have those functions because it was Compiled by GCC 2.8, and you get undefined symbol errors. The Symbols in Question Are Named Things Like `__register_frame_info '.
For glibc 2.0, the workaround is to not compile libc with egcs. We've also incorporated a patch which should prevent the EH functions sneaking into libc. It does not matter what compiler you use to compile your program.For glibc 2.1, we 'Ve Chosen to Do It The...............................
{UD} Starting with glibc 2.1.1 you can compile glibc with gcc 2.8.1 or newer since we have explicitly add references to the functions causing the problem. But you nevertheless should use EGCS for other reasons (see question 1.2).
{GK} On some Linux distributions for PowerPC, you can see this when you have built gcc or egcs from the Web sources (gcc versions 2.95 or earlier), then re-built glibc. This happens because in these versions of gcc, exception handling IS IMPLEMENTED Using An Older Method; The People Making The Distributions Are A Little Ahead of Their Time.
A Quick Solution To this Is To Find The Libgcc.a File That Came with The Distribution (IT Would Have Been Installed Under / USR / LIB / GCC-LIB), DO `Ar x libgcc.a frame.o 'to get the frame .o file out, and add a line saying `ldlibs-c.so = frame.o 'to the file` configparms' in the directory you're building in. You can check you've got the right `frame.o 'file by running `nm frame.o' and checking this it has the symbols defined That You're missing.
This Will Let You Build Glibc with the c compiler. The C Compiler Will Still Be binary incompatible with any C Shared Libraries That You Got with your distribution.
2.9. How can I Compile GCC 2.7.2.1 from the GCC Source Code Using Glibc 2.x? {Aj} There's Only Correct Support for Glibc 2.0.x in GCC 2.7.2.3 or Later. But You Should Get At Least GCC 2.95. 3 (or later versions) anyway2.10. The `gencat 'utility can not process the catalog sources which were used on my Linux libc5 based system. Why? {UD} The` gencat' utility provided with glibc complies to the XPG standard. The Older Linux Version Did NOT Obey The Standard, So They is not compatible.
To ease the transition from the Linux version some of the non-standard features are also present in the `gencat 'program of GNU libc. This mainly includes the use of symbols for the message number and the automatic generation of header files which contain the needed #defines to map the symbols to integers.
Here Is A Simple Script to Convert At Least Some Linux Specific Catalog Files To The XPG4 Form:
# Change Catalog Source in Linux Specific Format To Standard Xpg Format.
# ULRICH DREPPER
#
/ ^ / $ # / {
hide
s // $ # / ([^] * /). * // 1 /
x
S // $ # [^] * * / (. * /) // $ / 1 /
}
/ ^ # / {
s / ^ # /( ((/ )//1/
G
s //(./)/ n /(.*/ ]// 2/1 /
}
. 2.11 Programs using libc have their messages translated, but other behavior is not localized (eg collating order); why {ZW} Translated messages are automatically installed, but the locale database that controls other behaviors is not You need to run localedef to?. Install this Database, After You Have Run `make INSTALL '. for Example, To Set up The French Canadian Locale, SIMPLY ISSUE THE COMMAND
LocaleDef -i fr_ca -f ISO-8859-1 fr_ca
Please see localedata / readme in the source tree for further details.
2. I have set up /etc/nis.conf, and and the Linux libc 5 with Nys Works Great. But The Glibc Nis Doesn't Seem to Work. {TK} The glibc NIS Implementation Uses A / VAR / NIS / NIS_COLD_START FILE for storing information about the NIS server and their public keys, because the nis.conf file does not contain all the necessary information. You have to copy a NIS_COLD_START file from a Solaris client (the NIS_COLD_START file is byte order independent) or generate it with Nisinit from the nis-tools package; available athttp://www.suse.de/~kukuk/linux/nisplus.html
2.13. I have killed ypbind to stop using NIS, but glibc continues using NIS. {TK} For faster NIS lookups, glibc uses the / var / yp / binding / files from ypbind. Ypbind 3.3 and older versions do not always remove these Files, SO Glibc Will Continue To Use Them. Other BSD Versions Seem to Work Correctly. Until Ypbind 3.4 IS Released, You Can Find A Patch At
ftp://ftp.kernel.org/pub/linux/UTILS/NET/NIS/ypbind-3.3-glibc4.diff.gz
. 2.14 Under Linux / Alpha, I always get "do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused" when using NIS {TK} You need a ypbind version which is 64bit clean Some versions are not 64bit clean... A 64bit Clean Implementation IS YPBIND-MT. For YPBIND 3.3, You NEED The PATCH FTP.kernel.org (See The Previous Question). I don't know about other.
2.15. After installing glibc name resolving does not work properly. {AJ} You probably should read the manual section describing nsswitch.conf (just type `info libc" NSS Configuration File " '). The NSS configuration file is usually the culprit.
2.16. How do I create the databases for NSS? {AJ} If you have an entry "db" in /etc/nsswitch.conf you should also create the database files. The glibc sources contain a Makefile which does the necessary conversion and calls to create those files. The file is `db-Makefile 'in the subdirectory` nss' and you can call it with `make -f db-Makefile'. Please note that not all services are capable of using a database. Currently passwd, Group, Ethers, Protocol, RPC, Services Shadow and NetGroup Arement. See Also Question 2.31.
2.17. I have / usr / include / net and / usr / include / scsi as symlinks into my Linux source tree. Is that wrong? {PB} This was necessary for libc5, but is not correct when using glibc. Including the kernel header FILES DIRECTLY IN User Programs Usually Does Not Work (See Question
3.5). Glibc provides its own
2.18. Programs like `logname ',` top', `uPtime '` Users', `w 'and` WHO', SHOW INCORRECT Information About The (Number of) Users on My System. Why? {Mk} See Question
3.2.
2.19. After upgrading to glibc 2.1 with symbol versioning I get errors about undefined symbols. What went wrong? {AJ} The problem is caused either by wrong program code or tools. In the versioned libc a lot of symbols are now local that were global Symbols in Previous Versions. It Sees That Programs Linked Against Older Versions Offen Accidentally Used Libc Global Variables - Sometting That Should Not Happen.
. The only way to fix this is to recompile your program Sorry, that's the price you might have to pay once for quite a number of advantages with symbol versioning.2.20 When I start the program XXX after upgrading the library I get XXX:. Symbol `_sys_errlist 'has different size in shared object, consider re-linking Why? What should I do? {UD} As the message says, relink the binary. The problem is that a few symbols from the library can change in size and there is No Way to Avoid this. _sys_errlist is a good example. Occasionally theree area new error Numbers added to the kernel and this must be reflected at user level, breaking programs trative..
Such symbols should normally not be used at all. There are mechanisms to avoid using them. In the case of _sys_errlist, there is the strerror () function which should _always_ be used instead. So the correct fix is to rewrite that part of the application .
In Some Situations (Especially WHEN TESTING A NEW LIBRARY RELESE) IT Might Be Possible That Symbol Changed Size When That Should Not Have Happend SUCH A WARNING MESSAGE A Problem.
2.21. What do I need for C development? {HJ, AJ} You need either egcs 1.1 which comes directly with libstdc or gcc-2.8.1 together with libstdc 2.8.1.1. Egcs 1.1 has the better C support and works directly with glibc 2.. If you use GCC-2.8.1 with libstdc 2.8.1.1, you need to modify libstdc a bit. A patch is available as:
ftp://alpha.gnu.org/gnu/libstdc -2.8.1.1-glibc2.1-diff.gz
Please Note That Libg 2.7.2 (AND the Linux Versions 2.7.2.x) Doesn't Work Very To Vtable Thunks. If You're Upgrading from Glibc 2.0.x to 2.1 You Have To Recompile libstdc since the library compiled for 2.0 is not compatible due to the new Large File Support (LFS) in version 2.1. {UD} But since in the case of a shared libstdc the version numbers should be different existing programs will continue to work.
2.22. Even statically linked programs need some shared libraries which is not acceptable for me. What can I do? {AJ} NSS (for details just type `info libc" Name Service Switch " ') will not work properly without shared libraries. NSS allows using different services (eg NIS, files, db, hesiod) by just changing one configuration file (/etc/nsswitch.conf) without relinking any programs. The only disadvantage is that now static libraries need to access shared libraries. This is Handled transparently by the gnu c library.
A Solution IS To Configure Glibc with --enable-static-nss. In this case you can create a static binary tria Will Use online.conf for this. You need to link evlicitly Against All these Services. for example:
GCC -STATIC TEST-Netdb.c -o test-netdb /
-Wl, - start-group -lc -lnss_files -lnss_dns -lresolv -wl, - End-Group
The Problem With this approach is this You'Ve Got To Link Every Program That Uses NSS Routines with all those libraries.
{UD} In fact, one can not say anymore that a libc compiled with this option is using NSS. There is no switch anymore. Therefore it is * highly * recommended * not * to use --enable-static-nss since this makes the behaviour of the programs on the system inconsistent.2.23. I just upgraded my Linux system to glibc and now I get errors whenever I try to link any program. {ZW} This happens when you have installed glibc as the primary C library but have stray Symbolic Links Pointing at Your Old C Library. If The First `Libc.so 'The Linker Finds IS Libc 5, It Will Use That. Your Program Expects To Be Linked with Glibc, So The Link Fails.
THE MOST Common Case Is That Glibc Put ITS `Libc.so 'In / USR / Lib, But There Was A` libc.so' from Libc 5 in / lib, Which Gets Searched First. To FIX THE PROBLEM, JUST DELETE / LIB /Libc.so. You May Also Need To Delete Other Symbolic Links IN / LIB, Such as /Lib/Libm.so if it Points to libm.so.5.
{AJ} The perl script test-installation.pl which is run as last step during an installation of glibc that is configured with --prefix = / usr should help detect these situations. If the script reports problems, something is really screwed up.
2.24. When I use nscd the machine freezes. {UD} You can not use nscd with Linux 2.0. *. There is functionality missing in the kernel and work-arounds are not suitable. Besides, some parts of the kernel are too buggy when it Comees to using threads.
If You NEED NSCD, You Have to Use At Least A 2.1 Kernel.
Note That I have at this point no information about any Other Platform.
2.25. I need lots of open files. What do I have to do? {AJ} This is at first a kernel issue. The kernel defines limits with OPEN_MAX the number of simultaneous open files and with FD_SETSIZE the number of used file descriptors. You need to change these values in your kernel and recompile the kernel so that the kernel allows more open files. You do not necessarily need to recompile the GNU C library since the only place where OPEN_MAX and FD_SETSIZE is really needed in the library itself is the size of fd_set which is used by select.The GNU C library is now select free. This means it internally has no limits imposed by the `fd_set 'type. Instead all places where the functionality is needed the` poll' function is used.
IF you increase the Number of File Descriptors in the kernel you don't need to recompile the c library.
{Ud} you can always get the maximum number of file descriptors a process is allowed to have open at any time using
Number = sysconf (_sc_open_max);
This Will Work Even if The Kernel Limits Change.
2.26. How do I get the same behavior on parsing / etc / passwd and / etc / group as I have with libc5? {TK} The name switch setup in /etc/nsswitch.conf selected by most Linux distributions does not support / - and netgroup entries in the files like / etc / passwd Though this is the preferred setup some people might have setups coming over from the libc5 days where it was the default to recognize lines like this to get back to the old behaviour one simply.. Has to change the rules for passwd, group, and shadow in the nsswitch.conf file askLLOWS:
Passwd: compat
Group: Compat
Shadow: Compat
PASSWD_COMPAT: NIS
GROUP_COMPAT: NIS
Shadow_compat: NIS
2.27. What needs to be recompiled when upgrading from glibc 2.0 to glibc 2.1? {AJ, CG} If you just upgrade the glibc from 2.0.x (x <= 7) to 2.1, binaries that have been linked against glibc 2.0 will continue to work.If you compile your own binaries against glibc 2.1, you also need to recompile some other libraries. The problem is that libio had to be changed and therefore libraries that are based or depend on the libio of glibc, eg ncurses, slang and MOST C Libraries, Need to Be Recompiled. If You Experience Strange Segmentation Faults in Your Programs Linked Against Glibc 2.1, You Might NEED To Recompile your libraries.
Another problem is that older binaries that were linked statically against glibc 2.0 will reference the older nss modules (libnss_files.so.1 instead of libnss_files.so.2), so do not remove them. Also, the old glibc-2.0 compiled static libraries (libfoo.a) which happen to depend on the older libio behavior will be broken by the glibc 2.1 upgrade. We plan to produce a compatibility library that people will be able to link in if they want to compile a static library generated against glibc 2.0 INTO A Program On A Glibc 2.1 System. You Just Add -lcompat and You Should Be Fine.
The glibc-compat add-on will provide the libcompat.a library, the older nss modules, and a few other files. Together, they should make it possible to do development with old static libraries on a glibc 2.1 system. This add-on Is Still in Development. You Can Get IT from
ftp://alpha.gnu.org/gnu/glibc/glibc-compat-2.1.tar.gz
But please Keep In Mind That It is experimental.
2.28. Why is extracting files via tar so slow? {AJ} Extracting of tar archives might be quite slow since tar has to look up userid and groupids and does not cache negative results. If you have nis or nisplus in your / etc / nsswitch.conf for the passwd and / or group database, each file extractions needs a network connection There are two possible solutions:. do you really need NIS / NIS (some Linux distributions add by default nis / nisplus even if it's not needed)? IF not, Just Remove The Entries. If you need NIS / NIS , Use the name service cache daemon nscd That Comes with Glibc 2.1.
2.29. Compiling Programs I get Parse Errors in Libio.h (E.G. "Parse Error Before` _io_seekoff '"). How Should I Fix this? {Aj} you might get the following errors when Upgrading to Glibc 2.1:
In file incros /usr/include/stdio.h:57,
From ...
/usr/include/libio.h:335: Parse Error Before `_io_seekoff '
/usr/include/libio.h:335: Parse error before `_g_off64_t '
/usr/include/libio.h:336: Parse Error Before `_io_seekpos'
/usr/include/libio.h:336: parse error before `_g_fpos64_t '
The problem is a wrong _G_config.h file in your include path. The _G_config.h file that comes with glibc 2.1 should be used and not one from libc5 or from a compiler directory. To check which _G_config.h file the compiler uses, compile Your Program with `GCC-E ... | GREP G_CONFIG.H 'AND Remove That File. Your Compiler Should Pick Up The File That Has BEEN Installed by Glibc 2.1 in Your Include Directory.
2.30. After Upgrading to Glibc 2.1, Libraries That Wepace Compiled Against Glibc 2.0.x Don't Work Anymore. {AJ} See Question
2.27.
2.31. What happened to the Berkeley DB libraries? Can I still use db in /etc/nsswitch.conf?{AJ} Due to too many incompatible changes in disk layout and API of Berkeley DB and a too tight coupling of libc and libdb, the db library has been removed completely from glibc 2.2. The only place that really used the Berkeley DB was the NSS db module.The NSS db module has been rewritten to support a number of different versions of Berkeley DB for the NSS db module. Currently . the releases 2.x and 3.x of Berkeley DB are supported The older db 1.85 library is not supported You can use the version from glibc 2.1.x or download a version from Sleepycat Software (http:. //www.sleepycat. COM). The Library Has To Be Compiled AS Shared Library and Installed In The System Lib Directory (NormalLib). The Library Needs to Have A Special Soname To Be found by the nss module.
IF public structures change in a new Berkeley DB Release, this Needs to be reflected in Glibc.
Currently The Code Searches for Libraries with a Soname of "Libdb.So.3" (That the name from DB 2.4.14 Which Comes with glibc 2.1.x) and "libdb-3.0.so" (the name used by db 3.0. 55 as default).
THE NSS_DB MODULE IS NOW IN A Separate Package Since IT Requires A Database Library Being Available.
.? 2.32 What has do be done when upgrading to glibc 2.2 {AJ} The upgrade to glibc 2.2 should run smoothly, there's in general no need to recompile programs or libraries Nevertheless, some changes might be needed after upgrading.:
The utmp daemon has been removed and is not supported by glibc anymore. If it has been in use, it should be switched off. Programs using IPv6 have to be recompiled due to incompatible changes in sockaddr_in6 by the IPv6 working group. The Berkeley db libraries have been removed (for details see question 2.31). The format of the locale files has changed, all locales should be regenerated with localedef. All statically linked applications which use i18n should be recompiled, otherwise they'll not be localized. glibc comes with a number of new applications. for example ldconfig has been implemented for glibc, the libc5 version of ldconfig is not needed anymore. There's no more K & R compatibility in the glibc headers. The GNU C library requires a C compiler that handles especially prototypes correctly. Especially GCC - TRADITIONAL WILL NOT WORK with GLIBC Headers. please Read Also The News File Which Is The Authoritative Source for this and gives more details for some Topics.2.33. The makefi les want to do a CVS commit. {UD} Only if you are not specifying the --without-cvs flag at configure time. This is what you always have to use if you are checking sources directly out of the public CVS repository or you Have Your Own Private Repository.
2.34. When compiling C programs, I get a compilation error in streambuf.h. {BH} You are using g 2.95.2? After upgrading to glibc 2.2, you need to apply a patch to the include files in / usr / include / G , Because the fpos_t type has change in Glibc 2.2. The Patch IS AT
http://www.haible.de/bruno/gccclude-glibc-2.2-compat.diff
2.35. When recompiling GCC, I get compilation errors in libio. {BH} You are trying to recompile gcc 2.95.2? Use gcc 2.95.3 instead. This version is needed because the fpos_t type and a few libio internals have changed in glibc 2.2, And GCC 2.95.3 Contains a Corresponding Patch.2.36. Why Shall Glibc Never Get Installed On GNU / Linux Systems IN / USR / LOCAL? {Aj} THE GNU C Compiler Treats / USR / local / include and / usr / local / include and / usr / local / / lib in a special way, these directories will be searched before the system directories. Since on GNU / Linux the system directories / usr / include and / usr / lib contain a --- possibly different --- version of glibc and mixing certain files from different glibc installations is not supported and will break, you risk breaking your complete system. If you want to test a glibc installation, use another directory as argument to --prefix. If you like to install this glibc version as default version, Overriding the existing one, use --prefix = / usr and everything will go in the right place ES.
2.37. When recompiling GCC, I get compilation errors in libstdc . {BH} You are trying to recompile gcc 3.2? You need to patch gcc 3.2, because some last minute changes were made in glibc 2.3 which were not known when gcc 3.2 was released The Patch IS AT.
http://www.haible.de/bruno/gcc-3.2-glibc-2.3-compat.diff
3. Source and Binary Incompatibilities, and what to do about them
3.1. I Expect GNU libc to be 100% Source Code Compatible with the old linux based gnu libc. Why isn't it like this? {Dmt, ud} NOTESTERY EXTENSION IN Linux Libc's History Was WAS WELL THOUGHT-OUT. IN FACT IT Had a Lot of Problems With Standards Compliance and with a new version number these errors can now be corrected. here is a list of the know source code incompaits: 0000-00-00 0000-00-00 0000-00-00
_GNU_SOURCE:. Glibc does not make the GNU extensions available automatically If a program depends on GNU extensions or some other non-standard functionality, it is necessary to compile it with the C compiler option -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE 'at the beginning of your source files, before any C library header files are included. This difference normally manifests itself in the form of missing prototypes and / or data type definitions. Thus, if you get such errors, the first thing you should do . is try defining _GNU_SOURCE and see if that makes the problem go away For more information consult the file `NOTES 'in the GNU C library sources reboot ():. GNU libc sanitizes the interface of reboot () to be more compatible with the interface used on other OSes. reboot () as implemented in glibc takes just one argument. This argument corresponds to the third argument of the Linux reboot system call. That is, a call of the form reboot (a, b, c) needs to be Changed Into Reboot (C) Beside this the header
. The old libc often (erroneously) declared this variable implicitly as a side-effect of including other libc header files. Glibc is careful to avoid such namespace pollution, which, in turn, means that you really need to include the header files that you depend on This difference normally manifests itself in the form of the compiler complaining about references to an undeclared symbol "errno" Linux-specific syscalls:.. All Linux system calls now have appropriate library wrappers and corresponding declarations in various header files This is because. the syscall () macro that was traditionally used to work around missing syscall wrappers are inherently non-portable and error-prone. The following table lists all the new syscall stubs, the header-file declaring their interface and the system call name. syscall name : wrapper name: Declaring header file: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------
Bdflush Bdflush
Syslog ksyslog_ctl
lpd: Older versions of lpd depend on a routine called _validuser () The library does not provide this function, but instead provides __ivaliduser () which has a slightly different interface Simply upgrading to a newer lpd should fix this problem (eg, the.. 4.4BSD lpd is known to be working) resolver functions / BIND:. like on many other systems the functions of the resolver library are not included in libc itself There is a separate library libresolv If you get undefined symbol errors for symbols starting with.. `res_ * 'simply add -lresolv to your linker command line. the` signal' function's behavior corresponds to the BSD semantic and not the SysV semantic as it was in libc-5. The interface on all GNU systems shall be the same and BSD is the semantic of choice. To use the SysV behavior simply use `sysv_signal ', or define _XOPEN_SOURCE. See question 3.7 for details.3.2. Why does getlogin () always return NULL on my Linux box? {UD} The GNU C library has A Format for the Utmp and WTMP File W hich differs from what your system currently has. It was extended to fulfill the needs of the next years when IPv6 is introduced. The record size is different and some fields have different positions. The files written by functions from the one library can not be read by .
3.3. Where are the DST_ * constants found in
Instead GNU libc contains zone database support and compatibility code for POSIX TZ environment variable handling. For former is very much preferred (see question 4.3) .3.4. The prototypes for `connect ',` accept', `getsockopt ',` setsockopt', `GetSockName ',` Getpeername', `Send ',` Sendto', And `Recvfrom 'Are Different in gnu libc from any other system I SAW. this is a bug, isn't it? {ud} no, this is no bug. This version of GNU libc already follows the new Single Unix specifications (and I think the POSIX.1g draft which adopted the solution). The type for a parameter describing a size is now `socklen_t ', a new type.
3.5. On Linux I've got problems with the declarations in Linux kernel headers. {UD, AJ} On Linux, the use of kernel headers is reduced to the minimum. This gives Linus the ability to change the headers more freely. Also, User Programs Are Now Insulate from Changes in The Size of Kernel Data Structures.
For example, the sigset_t type is 32 or 64 bits wide in the kernel. In glibc it is 1024 bits wide. This guarantees that when the kernel gets a bigger sigset_t (for POSIX.1e realtime support, say) user programs will not have to BE Recompiled. Consult the header files for more information about the change.
THHEREFORE You Shouldn't include Linux Kernel Header Files Directly if Glibc HAS Defined A Replacement. Other You Might Get Undefined Results Because of Type Conflicts.
3.6. I do not include any kernel headers myself but the compiler still complains about redeclarations of types in the kernel headers. {UD} The kernel headers before Linux 2.1.61 and 2.0.32 do not work correctly with glibc. Compiling C programs is possible in most cases but C programs have (due to the change of the name lookups for `struct's) problems. One prominent example is` struct fd_set'.There might be some problems left but 2.1.61 / 2.0.32 fix most Of The Known Ons. See The Bugs File for Other Known Problems.
3.7. Why do not signals interrupt system calls anymore? {ZW} By default GNU libc uses the BSD semantics for signal (), unlike Linux libc 5 which used System V semantics. This is partially for compatibility with other systems and partially because the BSD Semantics Tend to make Programming with signals easier.
There is Three Differences:
BSD-style signals that occur in the middle of a system call do not affect the system call; System V signals cause the system call to fail and set errno to EINTR BSD signal handlers remain installed once triggered System V signal handlers work only once.. , so one must reinstall them each time. A BSD signal is blocked during the execution of its handler. In other words, a handler for SIGCHLD (for example) does not need to worry about being interrupted by another SIGCHLD. It may, however, be interrupted by other signals. There is general consensus that for `casual 'programming with signals, the BSD semantics are preferable. you do not need to worry about system calls returning EINTR, and you do not need to worry about the race conditions Associated with one-shot signal handlers.
If you are porting an old program that relies on the old semantics, you can quickly fix the problem by changing signal () to sysv_signal () throughout. Alternatively, define _XOPEN_SOURCE before including
IF All You Want Is for One Specific Signal To Cause System Calls To Fail and Return Eintr (for Example, TO IMPLEMENT A TIMEOUT) You Can do this with siginterrupt ().
3.8. I've got errors compiling code that uses certain string functions. Why? {AJ} glibc 2.1 has special string functions that are faster than the normal library functions. Some of the functions are additionally implemented as inline functions and others as macros. This Might Lead To Problems With existing codes but it is expeby set by ISO C.
The Optimized String Functions Are ONLY USED WHEN Compiling with Optimizations (-o1 or higher). The Behavior Can Be Changed with Two Feature Macros:
__NO_STRING_INLINES: Do not do any string optimizations __USE_STRING_INLINES: Use assembly language inline functions (might increase code size dramatically) Since some of these string functions are now additionally defined as macros, code like "char * strncpy ();" doesn '.. T Work Anymore (and is unnenecessary, since
{UD} Another problem in this area is that gcc still has problems on machines with very few registers (eg, ix86). The inline assembler code can require almost all the registers and the register allocator can not always handle this situation.One can disable the String Optimizations SELECTIELY. INSTEAD OF WRITING
Cp = STRCPY (foo, "lkj");
One Can Write
CP = (strcpy) (foo, "lkj");
This Disables The Optimization for That Specific Call.
3.9. I get Compiler Messages "Initializer Element Not Constant" with stdin / stdout / stderr. Why? {Rm, aj} constructs like:
Static file * INPTR = stdin;
Lead to this message. This is the correct behaviour with glibc Since stdin is not a constant expression. Please Note That A Strict Reading of Iso C Does Not Allow Above Constructs.
One of the advantages of this is that you can assign to stdin, stdout, and stderr just like any other global variable (eg `stdout = my_stream; '), which can be very useful with custom streams that you can write with libio (but BEWARE THIS Not Necessarily Portable. The Reason To Implement It this Way Were Versioning Problems with the size of the file structure.
TO FIX Those Programs You've Got To Initialize The Variable At Run Time. This Can Be Done, E.G. IN Main, Like:
Static file * INPTR;
Int main (void)
{
INPTR = stdin;
}
Or by Constructors (BEWARE this is gcc specific):
Static file * INPTR;
Static void inptr_construct (void) __ATtribute __ (condition));
Static void inptr_construct (void) {INPTR = stdin;}
3.10. I can't compile with gcc --traditional (or -traditional-cpp). Why? {Aj} glibc2 does break -traditional and -traditonal-cpp - and will continue contracts of the form: enum {foo
#define foo foo
}
Are useful for debugging purposes (You can use foo with your debugger That's why we need the enum) and for Compatibility (Other Systems Use Defines and Check with #ifDef).
3.11. I get Some Errors with `gcc -ansi '. ISN' {aj} The gnu c library is compatible with the ANSI / ISO C Standard. If're using` gcc -ansi ', The glibc includes which are specified in the standard follow the standard The ANSI / ISO C standard defines what has to be in the include files -.. and also states that nothing else should be in the include files (btw you can still enable additional standards with feature Flags).
......................... ..
3.12. I can not access some functions anymore. Nm shows that they do exist but linking fails nevertheless. {AJ} With the introduction of versioning in glibc 2.1 it is possible to export only those identifiers (functions, variables) that are really needed by application programs and by other parts of glibc. This way a lot of internal interfaces are now hidden. nm will still show those identifiers but marking them as internal. ISO C states that identifiers beginning with an underscore are internal to the libc. An application program normally should not use those internal interfaces (there are exceptions, eg __ivaliduser). If a program uses these interfaces, it's broken. These internal interfaces might change between glibc releases or dropped completely.3.13. When using the db-2 library which Comes with glibc is buy in the Perl DB Modules The TestSuite IS Not Passed. This Did NOT HAPPEN WITH DB-1, GDBM, OR NDBM. {} Removed. Does Not Apply Anymore.
3.14. The pow () inline function I get when including
3.15. The definition of `union semun '. {Ud} Nope. This Union Has To Be supplied by The User Program. FORMER GLIBC VERSIONS Defined this But It Was An Error Since It Does Not Make Much sense when thinking about it. The standards describing the System V IPC functions define it this way and therefore programs must be adopted.3.16. Why has
3.17. I get floods of warnings when I use -wconversion and incrude
-Wconversion isn't really intended for production use, Only for Shakedown Compiles After Converting An Old Program To Standard C.
3.18. After upgrading to glibc 2.1, I receive errors about unresolved symbols, like `_dl_initial_searchlist 'and can not execute any binaries. What went wrong? {AJ} This normally happens if your libc and ld (dynamic linker) are from different releases of Glibc. for example, the dynamic linker /lib/ld-linux.so.2 comes from glibc 2.0.x, but the version of libc.so.6 is from Glibc 2.1.
THE PATH /LIB/LD-LINUX.SO.2 IS HARDCODEDIN EVERY GLIBC2 Binary But Libc.so.so. Searched Via /etc/ld.so.cache and in Some Special DirectorIn LIKE / LIB AND / USR / LIB. IF You Run Configure with Another Prefix Than / usr and put this prefix before / lib in /etc/ld.so.conf, Your system will break.so what can you do? Either of the Following SHOULD WORK:
Run `configure 'with the Same prefix argument you've sale for glibc 2.0.x so what the Same path area used. Replace /Lib/ld-linux.so.2 with a link to the dynamic linker from glibc 2.1. You CAN Even Call the Dynamic Linker by Hand if everything fails. You'Ve got to set ld_library libc is found and also need to provide an absolute path to your binary:
LD_LIBRARY_PATH =
For example `ld_library_path = / libold /libold/ld-linux.so.2 / bin / mv ... 'Might Be Useful In Fixing a Broken System (if / libold contains Dynamic Linker and Corresponding Libc).
With That Command Line No path is buy. To further debug problem with the dynamic linker, use the ld_debug environment variable, e.g. `ld_debug = help echo 'for the help text.
If you just want to test this release, do not put the lib directory in /etc/ld.so.conf. You can call programs directly with full paths (as above). When compiling new programs against glibc 2.1, you've Got To Specify THE CORRECT PATHS TO THE Compiler (Options - Dynamic-Linker, -l and --rpath).
3.19. Bonnie reports that char i / o with glibc 2 is much slower than with libc5. What can be done? {AJ} The GNU C library uses thread safe functions by default and libc5 used non thread safe versions. The non thread safe functions have in glibc the suffix `_unlocked ', for details check
3.21. Autoconf's AC_CHECK_FUNC macro reports that a function exists, but when I try to use it, it always returns -1 and sets errno to ENOSYS. {ZW} You are using a 2.0 Linux kernel, and the function you are trying to use is Only Implement in 2.2.2. libc considers this to be a function which exists, Because if you upgrade to a 2.2 kenel, IT Will Work. One Such Function is SigaltStack.
Your program should check at runtime whether the function works, and implement a fallback. Note that Autoconf can not detect unimplemented functions in other systems' C libraries, so you need to do this anyway.
3.22. My Program Segfaults When i call fclose () on the file * returned from setmntent (). IS this a glibc bug? {Gk} No. Don't do this. Use endmntent (), That's what it's for.
IN General, You Should Use the Correct Deallocation Routine. For Instance, IF you Open A file Using fopen (), You Should Deallocate the file * using fclose (), not free (), Even wegh the file * is Also a Pointer.
In the case of setmntent (), IT May Appear to Work In Most Cases, But n't Always Work. Unfortunately, for Compatibility Reasons, We can't Change The Return Type Other Than File *. 3.23. I get "undefined reference to` atexit '"{ud} this means That Your Installation is Somehow Broken. The Situation Is The Same As for' Stat ',' Fstat ', ETC (See Question
2.7). Investigate Why The Linker Does Not Pick Up libc_nonshared.a.
IF a Similar Message Is Issued At Runtime This Means That The Application Or DSO is Not Linked Against Libc. This Can Cause Problems Since 'Atexit' Is Not Exported Anymore.
4. Miscellaneous
4.1. After I changed configure.in I get `Autoconf version XY or higher is required for this script '. What can I do? {UD} You have to get the specified autoconf version (or a later one) from your favorite mirror of ftp.gnu.org.
4.2. When I try to compile code which uses IPv6 headers and definitions on my Linux 2.xy system I am in trouble. Nothing seems to work. {UD} The problem is that IPv6 development still has not reached a point where the headers are Stable. There Are Still Lots of Incompatible Changes Made and The Libc Headers Have To Follow.
{PB} The 2.1 release of GNU libc aims to comply with the current versions of all the relevant standards. The IPv6 support libraries for older Linux systems used a different naming convention and so code written to work with them may need to be modified. If .............. ..
. IPv6 will not work with a 2.0.x kernel When kernel 2.2 is released it should contain all the necessary support; until then you should use the latest 2.1.x release you can find As of 98/11/26 the currently recommended kernel. For IPv6 is 2.1.129.also, as of the 2.1 Release The IPv6 API Provided by gnu libc is not 100% Complete.
4.3. When I set the timezone by setting the TZ environment variable to EST5EDT things go wrong since glibc computes the wrong time from this information. {UD} The problem is that people still use the braindamaged POSIX method to select the timezone using the TZ environment variable with a format EST5EDT or whatever. People, if you insist on using TZ instead of the timezone database (see below), read the POSIX standard, the implemented behaviour is correct! What you see is in fact the result of the decisions made while POSIX.1 WAS CREATED. We've Only Implement The Handling of Tz This Way To BE POSIX Compliant. It is not really meant to be used.
The alternative approach to handle timezones which is implemented is the correct one to use:.. Use the timezone database This avoids all the problems the POSIX method has plus it is much easier to use Simply run the tzselect shell script, answer the question and use The name printed in the end making a symlink / etc / localtime pointing to / us (name is the return value from tzselect). That's all. You never aga have to worry.
So, plete avoid sending bug reports about Time Related Problems if you use the Posix method and you.
4.4. What Other Sources of Documentation About Glibc Are Available? {Aj} The FSF HAS A Page About The GNU C Library AT
Http://www.gnu.org/software/libc/. The question in gnu libc is available athttp://www-gnats.gnu.org: 8080 / cgi-bin / wwwgnats.pl Eric Green Has Written A HOWTO for Converting from Linux Libc5 To Glibc2. The HOWTO IS Accessible Via The FSF Page and At
http://www.imaxx.net/~thtis/glibc. Frodo Looijaard Describes a Different Way Installing Glibc2 As Secondary Libc AT
http://huizen.dds.nl/~frodol/glibc.
Please Note That this is not a completion.
4.5. The timezone string for Sydney / Australia is wrong since even when daylight saving time is in effect the timezone string is EST. {UD} The problem for some timezones is that the local authorities decided to use the term "summer time" instead of "Daylight Saving Time". in This Case the Abbreviation Character `s' Is The Same as The Standard One. So, for Sydney We Have
Eastern Standard Time = EST
Eastern Summer Time = EST
GREAT! TO GET THIS BUG FIXED CONVINCE The Authorities To Change The Laws and Regulation of the Country This Effects. Glibc Behaves Correctly.
4.6. I'VE Build Make 3.77 Against Glibc 2.1 and now make gets segmentation faults. {} Removed. Does not Apply Anymore, Use make 3.79 or NEWER.
4.7. Why do so many programs using math functions fail on my AlphaStation? {AO} The functions floor () and floorf () use an instruction that is not implemented in some old PALcodes of AlphaStations. This may cause `Illegal Instruction 'core dumps Or endless loops in programs That catch these signals. Updating the firmware to a 1999 Release Has Fixed The Problem on an alphaastation 200 4/166.
4.8. The conversion table for character set XX does not match with what I expect. {UD} I do not doubt for a minute that some of the conversion tables contain errors. We tried the best we can and relied on automatic generation of the data to prevent human-introduced errors but this still is no guarantee. If you think you found a problem please send a bug report describing it and give an authoritive reference. The latter is important since otherwise the current behaviour is as good as the proposed one .Before doing this Look THROUGH The List of Known ProBLEM FIRST:
the GBK (simplified Chinese) encoding is based on Unicode tables This is good These tables, however, differ slightly from the tables used by the M $ people The differences are these [ Unicode, - M $]:... 0xA1AA 0x2015
0xA844 0x2014
-0xa1aa 0x2014
-0xa844 0x2015
In addition the Unicode tables contain mappings for the GBK characters 0xA8BC, 0xA8BF, 0xA989 to 0xA995, and 0xFE50 to 0xFEA0. When mapping from EUC-CN to GBK and vice versa we ignore the fact that the coded character at position 0xA1A4 maps to different Unicode CHARACTERS. Since The iconv () Implementation Can Do Whate It Wants if It cannot Directly Map A Character this is a perfectly Good Solution Since The Semantics and AppEaRance of The Character Does Not Change.
4.9. How can I find out which version of glibc I am using in the moment? {UD} If you want to find out about the version from the command line simply run the libc binary. This is probably not possible on all platforms but where IT IS SIMPLY LOCATE THE LIBC DSO and Start IT as an Application. on Linux Like
/LIB/LIBC.SO.6
This will produce all the information you need.
What Always Will Work Is To Use and Run The Following Little Program To Get The Version Information: ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include
#include
INT main (void) {PUTS (GNU_GET_LIBC_VERSION ()); Return 0;}
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
THIS Interface Can Also Obviously BE Used to Perform Tests At Runtime IF this Should Be Necessary.
... 4.10 Context switching with setcontext () does not work from within signal handlers {DMT} The Linux implementations (IA-64, S390 so far) of setcontext () supports synchronous context switches only There are several reasons for this:
UNIX provides no other (portable) way of effecting a synchronous context switch (also known as co-routine switch). Some versions support this via setjmp () / longjmp () but this does not work universally. As defined by the UNIX '98 standard, the only way setcontext () could trigger an asychronous context switch is if this function were invoked on the ucontext_t pointer passed as the third argument to a signal handler. But according to draft 5, XPG6, XBD 2.4.3, setcontext () is not among the set of routines that may be called from a signal handler. If setcontext () were to be used for asynchronous context switches, all kinds of synchronization and re-entrancy issues could arise and these problems have already been solved by real multi -threading libraries (eg, POSIX threads or Linux threads). Synchronous context switching can be implemented entirely in user-level and less state needs to be saved / restored than for an asynchronous context switch. It is therefore useful to distinguish between th e two types of context switches. Indeed, some application vendors are known to use setcontext () to implement co-routines on top of normal (heavier-weight) pre-emptable threads. It should be noted that if someone was dead-bent on using setcontext () on the third arg of a signal handler, then IA-64 Linux could support this via a special version of sigaction () which arranges that all signal handlers start executing in a shim function which takes care of saving the preserved registers before calling the real signal handler and restoring them afterwards. In other words, we could provide a compatibility layer which would support setcontext () for asynchronous context switches. However, given the arguments above, I don '
T thrnekText () Provides a decent CO-ROUTINE INTERFACE AND WEHOULD JUSTINE ANENCHRONUS USE (Which Just Calls for Trouble At Any Rate) .answers WERE GIVEN BY:
{Ud} Ulrich Drewper, <
Drepper@redhat.com>
{DMT} David Mosberger-Tang, <
Davidm@hpl.hp.com>
{Rm} roland mcGrath, <
Roland@gnu.org>
{Aj} andreas jaeger, <
Aj@ssuse.de>
{EY} Eric Youngdale, <
Eric@andante.jic.com>
{Pb} Phil Blundell, <
Philip.blundell@pobox.com>
{Mk} Mark Kettenis, <
Kettenis@phys.uva.nl>
{ZW} zack weinberg, <
Zack@rabi.phys.columbia.edu>
{TK} thorsten kukuk, <
Kukuk@suse.de>
{Gk} geoffrey key, <
Geoffk@redhat.com>
{Hj} h.j. lu, <
hjl@gnu.org>
{Cg} cristian gafton, <
Gafton@redhat.com>
{Ao} alexandre oliva, <
Aoliva@redhat.com>
{BRUNO HAIBLE, <
HaiBle@clisp.cons.org>
{SM} Steven Munroe, <
SJMunroe@us.ibm.com>
Please Note That The Original Version Doesn't Use HTMATIL AND THIS Page Script to Just Add A Few Html Tags. I Know That The HTML IS Not Perfect.
Andreas Jaegerlast Modified: sat apr 12 07:46:06 2003