--- FAQ.in.orig Thu Jun 21 13:31:02 2001 +++ FAQ.in Fri Jun 22 12:00:39 2001 @@ -1,3 +1,5 @@ +?{charset=us-ascii} +?{title-prefix=glibc FAQ: } Frequently Asked Questions about the GNU C Library This document tries to answer questions a user might have when installing @@ -388,6 +390,7 @@ however, install it alongside your existing libc. For Linux there are three major libc versions: + libc-4 a.out libc libc-5 original ELF libc libc-6 GNU libc @@ -420,8 +423,8 @@ option for this so you have to use a `configparms' file (see the `INSTALL' file for details). It should contain: -slibdir=/lib -sysconfdir=/etc + slibdir=/lib + sysconfdir=/etc The first line specifies the directory for the essential libraries, the second line the directory for system configuration files. @@ -483,11 +486,13 @@ 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 + + --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. When linking via gcc, you've got to add - -Wl,--dynamic-linker=/lib/ld-linux.so.2 + + -Wl,--dynamic-linker=/lib/ld-linux.so.2 to the gcc command line. @@ -507,53 +512,50 @@ Here is what the gcc-2.7.2 specs file should look like when GNU libc is installed at /usr: ------------------------------------------------------------------------ -*asm: -%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} - -*asm_final: -%| + *asm: + %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} -*cpp: -%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} + *asm_final: + %| -*cc1: -%{profile:-p} + *cpp: + %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} -*cc1plus: + *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}}} + *endfile: + %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s -*lib: -%{!shared: %{pthread:-lpthread} %{profile:-lc_p} %{!profile: -lc}} + *link: + -m elf_i386 %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} %{static:-static}}} -*libgcc: --lgcc + *lib: + %{!shared: %{pthread:-lpthread} %{profile:-lc_p} %{!profile: -lc}} -*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} + *libgcc: + -lgcc -*switches_need_spaces: + *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} + *switches_need_spaces: -*signed_char: -%{funsigned-char:-D__CHAR_UNSIGNED__} -*predefines: --D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) + *signed_char: + %{funsigned-char:-D__CHAR_UNSIGNED__} -*cross_compile: -0 + *predefines: + -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) -*multilib: -. ; + *cross_compile: + 0 ------------------------------------------------------------------------ + *multilib: + . ; Things get a bit more complicated if you have GNU libc installed in some other place than /usr, i.e., if you do not want to use it instead of the old @@ -574,7 +576,7 @@ or incorrect /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 ) + GROUP ( libc.so.6 libc_nonshared.a ) ??excpt When I run an executable on one system which I compiled on another, I get dynamic linker errors. Both systems have the same @@ -647,23 +649,21 @@ Here is a simple SED 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 , 1996. -# -/^\$ #/ { - h - s/\$ #\([^ ]*\).*/\1/ - x - s/\$ #[^ ]* *\(.*\)/\$ \1/ -} - -/^# / { - s/^# \(.*\)/\1/ - G - s/\(.*\)\n\(.*\)/\2 \1/ -} ------------------------------------------------------------------------ + # Change catalog source in Linux specific format to standard XPG format. + # Ulrich Drepper , 1996. + # + /^\$ #/ { + h + s/\$ #\([^ ]*\).*/\1/ + x + s/\$ #[^ ]* *\(.*\)/\$ \1/ + } + + /^# / { + s/^# \(.*\)/\1/ + G + s/\(.*\)\n\(.*\)/\2 \1/ + } ?? Programs using libc have their messages translated, but other behavior is not localized (e.g. collating order); why? @@ -673,7 +673,7 @@ 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 + localedef -i fr_CA -f ISO-8859-1 fr_CA Please see localedata/README in the source tree for further details. @@ -782,6 +782,7 @@ support and works directly with glibc 2.1. 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: + Please note that libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work @@ -808,8 +809,8 @@ (change /etc/nsswitch.conf for this). You need to link explicitly 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 + 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 that you've got to link every static program that uses NSS routines with all those libraries. @@ -882,13 +883,13 @@ the rules for passwd, group, and shadow in the nsswitch.conf file as follows: -passwd: compat -group: compat -shadow: compat - -passwd_compat: nis -group_compat: nis -shadow_compat: nis + passwd: compat + group: compat + shadow: compat + + passwd_compat: nis + group_compat: nis + shadow_compat: nis ??libs What needs to be recompiled when upgrading from glibc 2.0 to glibc 2.1? @@ -916,7 +917,9 @@ 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 + + but please keep in mind that it is experimental. ?? Why is extracting files via tar so slow? @@ -938,12 +941,12 @@ {AJ} You might get the following errors when upgrading to glibc 2.1: - In file included from /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' + In file included from /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 @@ -1242,11 +1245,12 @@ This disables the optimization for that specific call. -?? I get compiler messages "Initializer element not constant" with +?? I get compiler messages "Initializer element not constant" with stdin/stdout/stderr. Why? {RM,AJ} Constructs like: - static FILE *InPtr = stdin; + + static FILE *InPtr = stdin; lead to this message. This is correct behaviour with glibc since stdin is not a constant expression. Please note that a strict reading of ISO C does @@ -1261,17 +1265,17 @@ 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; - } + 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__((constructor)); - static void inPtr_construct (void) { InPtr = stdin; } + static FILE *InPtr; + static void inPtr_construct (void) __attribute__((constructor)); + static void inPtr_construct (void) { InPtr = stdin; } ?? I can't compile with gcc -traditional (or @@ -1280,9 +1284,9 @@ {AJ} glibc2 does break -traditional and -traditonal-cpp - and will continue to do so. For example constructs of the form: - enum {foo - #define foo foo - } + 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 @@ -1543,7 +1547,7 @@ fixed the problem on an AlphaStation 200 4/166. ?? The conversion table for character set XX does not match with -what I expect. + what I expect. {UD} I don't 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 @@ -1586,11 +1590,9 @@ What always will work is to use the API glibc provides. Compile and run the following little program to get the version information: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#include -#include -int main (void) { puts (gnu_get_libc_version ()); return 0; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #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. @@ -1641,20 +1643,21 @@ Answers were given by: -{UD} Ulrich Drepper, -{DMT} David Mosberger-Tang, -{RM} Roland McGrath, -{AJ} Andreas Jaeger, -{EY} Eric Youngdale, -{PB} Phil Blundell, -{MK} Mark Kettenis, -{ZW} Zack Weinberg, -{TK} Thorsten Kukuk, -{GK} Geoffrey Keating, -{HJ} H.J. Lu, -{CG} Cristian Gafton, -{AO} Alexandre Oliva, -{BH} Bruno Haible, + +* {UD} Ulrich Drepper, +* {DMT} David Mosberger-Tang, +* {RM} Roland McGrath, +* {AJ} Andreas Jaeger, +* {EY} Eric Youngdale, +* {PB} Phil Blundell, +* {MK} Mark Kettenis, +* {ZW} Zack Weinberg, +* {TK} Thorsten Kukuk, +* {GK} Geoffrey Keating, +* {HJ} H.J. Lu, +* {CG} Cristian Gafton, +* {AO} Alexandre Oliva, +* {BH} Bruno Haible, Local Variables: mode:outline