Update.
[glibc.git] / FAQ
blob1dcb3a3fb15deccab88d1e6c7d9ef75634fdd872
1                 Frequently Asked Question on GNU C Library
3 As every FAQ this one also tries to answer questions the user might have
4 when using the package.  Please make sure you read this before sending
5 questions or bug reports to the maintainers.
7 The GNU C Library is very complex.  The building process exploits the
8 features available in tools generally available.  But many things can
9 only be done using GNU tools.  Also the code is sometimes hard to
10 understand because it has to be portable but on the other hand must be
11 fast.  But you need not understand the details to use GNU C Library.
12 This will only be necessary if you intend to contribute or change it.
14 If you have any questions you think should be answered in this document,
15 please let me know.
17                                                   --drepper@cygnus.com
19 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
20 [Q1]    ``What systems does the GNU C Library run on?''
22 [Q2]    ``What compiler do I need to build GNU libc?''
24 [Q3]    ``When starting make I get only error messages.
25           What's wrong?''
27 [Q4]    ``After I changed configure.in I get `Autoconf version X.Y.
28           or higher is required for this script'.  What can I do?''
30 [Q5]    ``Do I need a special linker or archiver?''
32 [Q6]    ``Do I need some more things to compile GNU C Library?''
34 [Q7]    ``When I run `nm -u libc.so' on the produced library I still
35           find unresolved symbols?  Can this be ok?''
37 [Q8]    ``Can I replace the libc on my Linux system with GNU libc?''
39 [Q9]    ``I expect GNU libc to be 100% source code compatible with
40           the old Linux based GNU libc.  Why isn't it like this?''
42 [Q10]   ``Why does getlogin() always return NULL on my Linux box?''
44 [Q11]   ``Where are the DST_* constants found in <sys/time.h> on many
45           systems?''
47 [Q12]   ``The `gencat' utility cannot process the input which are
48           successfully used on my Linux libc based system.  Why?''
50 [Q13]   ``How do I configure GNU libc so that the essential libraries
51           like libc.so go into /lib and the other into /usr/lib?''
53 [Q14]   ``When linking with the new libc I get unresolved symbols
54           `crypt' and `setkey'.  Why aren't these functions in the
55           libc anymore?''
57 [Q15]   ``What are these `add-ons'?''
59 [Q16]   ``When I use GNU libc on my Linux system by linking against
60           to libc.so which comes with glibc all I get is a core dump.''
62 [Q17]   ``Looking through the shared libc file I haven't found the
63           functions `stat', `lstat', `fstat', and `mknod' and while
64           linking on my Linux system I get error messages.  How is
65           this supposed to work?''
67 [Q18]   ``The prototypes for `connect', `accept', `getsockopt',
68           `setsockopt', `getsockname', `getpeername', `send',
69           `sendto', and `recvfrom' are different in GNU libc than
70           on any other system I saw.  This is a bug, isn't it?''
72 [Q19]   ``My XXX kernel emulates a floating-point coprocessor for me.
73           Should I enable --with-fp?''
75 [Q20]   ``How can I compile gcc 2.7.2.1 from the gcc source code using
76           glibc 2.x?
78 [Q21]    ``On Linux I've got problems with the declarations in Linux
79            kernel headers.''
81 [Q22]   ``When I try to compile code which uses IPv6 header and
82           definitions on my Linux 2.x.y system I am in trouble.
83           Nothing seems to work.''
85 [Q23]   ``When compiling GNU libc I get lots of errors saying functions
86           in glibc are duplicated in libgcc.''
88 [Q24]   ``I have set up /etc/nis.conf, and the Linux libc 5 with NYS
89           works great.  But the glibc NIS+ doesn't seem to work.''
91 [Q25]   ``After installing glibc name resolving doesn't work properly.''
94 [Q26]   ``I have /usr/include/net and /usr/include/scsi as symlinks
95           into my Linux source tree.  Is that wrong?''
97 [Q27]   ``Programs like `logname', `top', `uptime' `users', `w' and
98           `who', show incorrect information about the (number of)
99           users on my system.  Why?''
101 [Q28]   ``After upgrading to a glibc 2.1 with symbol versioning I get
102           errors about undefined symbols.  What went wrong?''
104 [Q29]   ``I don't include any kernel header myself but still the
105           compiler complains about type redeclarations of types in the
106           kernel headers.''
108 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
109 [Q1]    ``What systems does the GNU C Library run on?''
111 [A1] {UD} This is difficult to answer.  The file `README' lists the
112 architectures GNU libc is known to run *at some time*.  This does not
113 mean that it still can be compiled and run on them in the moment.
115 The systems glibc is known to work on in the moment and most probably
116 in the future are:
118         *-*-gnu                 GNU Hurd
119         i[3456]86-*-linux-gnu   Linux-2.0 on Intel
120         m68k-*-linux-gnu        Linux-2.0 on Motorola 680x0
121         alpha-*-linux-gnu       Linux-2.0 on DEC Alpha
122         powerpc-*-linux-gnu     Linux and MkLinux on PowerPC systems
123         sparc-*-linux-gnu       Linux-2.0 on SPARC
124         sparc64-*-linux-gnu     Linux-2.0 on UltraSPARC
126 Other Linux platforms are also on the way to be supported but I need
127 some success reports first.
129 If you have a system not listed above (or in the `README' file) and
130 you are really interested in porting it, contact
132         <bug-glibc@prep.ai.mit.edu>
135 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
136 [Q2]    ``What compiler do I need to build GNU libc?''
138 [A2] {UD} It is (almost) impossible to compile GNU C Library using a
139 different compiler than GNU CC.  A lot of extensions of GNU CC are
140 used to increase the portability and speed.
142 But this does not mean you have to use GNU CC for using the GNU C
143 Library.  In fact you should be able to use the native C compiler
144 because the success only depends on the binutils: the linker and
145 archiver.
147 The GNU CC is found like all other GNU packages on
148         ftp://prep.ai.mit.edu/pub/gnu
149 or better one of the many mirror sites.
151 You always should try to use the latest official release.  Older
152 versions might not have all the features GNU libc could use.  It is
153 known that on most platforms compilers earlier than 2.7.2.3 fail so
154 at least use this version.
157 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
158 [Q3]    ``When starting `make' I get only errors messages.
159           What's wrong?''
161 [A3] {UD} You definitely need GNU make to translate GNU libc.  No
162 other make program has the needed functionality.
164 Versions before 3.74 have bugs which prevent correct execution so you
165 should upgrade to the latest version before starting the compilation.
168 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
169 [Q4]    ``After I changed configure.in I get `Autoconf version X.Y.
170           or higher is required for this script'.  What can I do?''
172 [A4] {UD} You have to get the specified autoconf version (or a later)
173 from your favourite mirror of prep.ai.mit.edu.
176 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
177 [Q5]    ``Do I need a special linker or archiver?''
179 [A5] {UD} If your native versions are not too buggy you can probably
180 work with them.  But GNU libc works best with GNU binutils.
182 On systems where the native linker does not support weak symbols you
183 will not get a really ISO C compliant C library.  Generally speaking
184 you should use the GNU binutils if they provide at least the same
185 functionality as your system's tools.
187 Always get the newest release of GNU binutils available.
188 Older releases are known to have bugs that affect building the GNU C
189 Library.
192 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
193 [Q6]    ``Do I need some more things to compile GNU C Library?''
195 [A6] {UD} Yes, there are some more :-).
197 * GNU gettext; the GNU libc is internationalized and partly localized.
198   For bringing the messages for the different languages in the needed
199   form the tools from the GNU gettext package are necessary.  See
200   ftp://prep.ai.mit.edu/pub/gnu or better any mirror site.
202 * lots of diskspace (for i?86-linux this means, e.g., ~170MB; for ppc-linux
203   even ~200MB).
205   You should avoid compiling on a NFS mounted device.  This is very
206   slow.
208 * plenty of time (approx 1h for i?86-linux on i586@133 or 2.5h on
209   i486@66 or 4.5h on i486@33), both for shared and static only).
210   Multiply this by 1.5 or 2.0 if you build profiling and/or the highly
211   optimized version as well.  For Hurd systems times are much higher.
213   For Atari Falcon (Motorola 68030 @ 16 Mhz, 14 Mb memory) James Troup
214   <J.J.Troup@comp.brad.ac.uk> reports for a full build (shared, static,
215   and profiled) a compile time of 45h34m.
217   For Atari TT030 (Motorola 68030 @ 32 Mhz, 34 Mb memory) (full build)
218   a compile time of 22h48m.
220   If you have some more measurements let me know.
222 * When compiling for Linux:
224   + the header files of the Linux kernel must be available in the
225     search path of the CPP as <linux/*.h> and <asm/*.h>.
227 * Some files depend on special tools.  E.g., files ending in .gperf
228   need a `gperf' program.  The GNU version (part of libg++) is known
229   to work while some vendor versions do not.
231   You should not need these tools unless you change the source files.
233 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
234 [Q7]    ``When I run `nm -u libc.so' on the produced library I still
235           find unresolved symbols?  Can this be ok?''
237 [A7] {UD} Yes, this is ok.  There can be several kinds of unresolved
238 symbols:
240 * magic symbols automatically generated by the linker.  Names are
241   often like __start_* and __stop_*
243 * symbols starting with _dl_* come from the dynamic linker
245 * symbols resolved by using libgcc.a
246   (__udivdi3, __umoddi3, or similar)
248 * weak symbols, which need not be resolved at all
249   (currently fabs among others; this gets resolved if the program
250    is linked against libm, too.)
252 Generally, you should make sure you find a real program which produces
253 errors while linking before deciding there is a problem.
256 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
257 [Q8]    ``Can I replace the libc on my Linux system with GNU libc?''
259 [A8] {UD} You cannot replace any existing libc for Linux with GNU
260 libc.  There are different versions of C libraries and you can run
261 libcs with different major version independently.
263 For Linux there are today two libc versions:
264         libc-4          old a.out libc
265         libc-5          current ELF libc
267 GNU libc will have the major number 6 and therefore you can have this
268 additionally installed.  For more information consult documentation for
269 shared library handling.  The Makefiles of GNU libc will automatically
270 generate the needed symbolic links which the linker will use.
273 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
274 [Q9]    ``I expect GNU libc to be 100% source code compatible with
275           the old Linux based GNU libc.  Why isn't it like this?''
277 [A9] {DMT,UD} Not every extension in Linux libc's history was well
278 thought-out.  In fact it had a lot of problems with standards compliance
279 and with cleanliness.  With the introduction of a new version number these
280 errors now can be corrected.  Here is a list of the known source code
281 incompatibilities:
283 * _GNU_SOURCE: glibc does not automatically define _GNU_SOURCE.  Thus,
284   if a program depends on GNU extensions or some other non-standard
285   functionality, it is necessary to compile it with C compiler option
286   -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at the beginning
287   of your source files, before any C library header files are included.
288   This difference normally manifests itself in the form of missing
289   prototypes and/or data type definitions.  Thus, if you get such errors,
290   the first thing you should do is try defining _GNU_SOURCE and see if
291   that makes the problem go away.
293   For more information consult the file `NOTES' part of the GNU C
294   library sources.
296 * reboot(): GNU libc sanitizes the interface of reboot() to be more
297   compatible with the interface used on other OSes.  In particular,
298   reboot() as implemented in glibc takes just one argument.  This argument
299   corresponds to the third argument of the Linux reboot system call.
300   That is, a call of the form reboot(a, b, c) needs to be changed into
301   reboot(c).
302      Beside this the header <sys/reboot.h> defines the needed constants
303   for the argument.  These RB_* constants should be used instead of the
304   cryptic magic numbers.
306 * swapon(): the interface of this function didn't changed, but the
307   prototype is in a separate header file <sys/swap.h>.  For the additional
308   argument of swapon() you should use the SWAP_* constants from
309   <linux/swap.h>, which get defined when <sys/swap.h> is included.
311 * errno: If a program uses variable "errno", then it _must_ include header
312   file <errno.h>.  The old libc often (erroneously) declared this variable
313   implicitly as a side-effect of including other libc header files.  glibc
314   is careful to avoid such namespace pollution, which, in turn, means that
315   you really need to include the header files that you depend on.  This
316   difference normally manifests itself in the form of the compiler
317   complaining about the references of the undeclared symbol "errno".
319 * Linux-specific syscalls: All Linux system calls now have appropriate
320   library wrappers and corresponding declarations in various header files.
321   This is because the syscall() macro that was traditionally used to
322   work around missing syscall wrappers are inherently non-portable and
323   error-prone.  The following tables lists all the new syscall stubs,
324   the header-file declaring their interface and the system call name.
326        syscall name:    wrapper name:   declaring header file:
327        -------------    -------------   ----------------------
328        bdflush          bdflush         <sys/kdaemon.h>
329        create_module    create_module   <sys/module.h>
330        delete_module    delete_module   <sys/module.h>
331        get_kernel_syms  get_kernel_syms <sys/module.h>
332        init_module      init_module     <sys/module.h>
333        syslog           ksyslog_ctl     <sys/klog.h>
335 * lpd: Older versions of lpd depend on a routine called _validuser().
336   The library does not provide this function, but instead provides
337   __ivaliduser() which has a slightly different interfaces.  Simply
338   upgrading to a newer lpd should fix this problem (e.g., the 4.4BSD
339   lpd is known to be working).
341 * resolver functions/BIND: like on many other systems the functions of
342   the resolver library are not included in the libc itself.  There is
343   a separate library libresolv.  If you find some symbols starting with
344   `res_*' undefined simply add -lresolv to your call of the linker.
346 * the `signal' function's behaviour corresponds to the BSD semantic and
347   not the SysV semantic as it was in libc-5.  The interface on all GNU
348   systems shall be the same and BSD is the semantic of choice.  To use
349   the SysV behaviour simply use `sysv_signal'.  The major difference is
350   that the SysV implementation sets the SA_ONESHOT flag and so the handler
351   gets removed after the first call.
354 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
355 [Q10]   ``Why does getlogin() always return NULL on my Linux box?''
357 [A10] {UD} The GNU C library has a format for the UTMP and WTMP file
358 which differs from what your system currently has.  It was extended to
359 fulfill the needs of the next years when IPv6 is introduced.  So the
360 record size is different, fields might have a different position and
361 so reading the files written by functions from the one library cannot
362 be read by functions from the other library.  Sorry, but this is what
363 a major release is for.  It's better to have a cut now than having no
364 means to support the new techniques later.
366 {MK} There is however a (partial) solution for this problem.  Please
367 take a look at the file `README.utmpd'.
370 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
371 [Q11]   ``Where are the DST_* constants found in <sys/time.h> on many
372           systems?''
374 [A11] {UD} These constants come from the old BSD days and are not used
375 today anymore (even the Linux based glibc does not implement the handling
376 although the constants are defined).
378 Instead GNU libc contains the zone database handling and compatibility
379 code for POSIX TZ environment variable handling.
382 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
383 [Q12]   ``The `gencat' utility cannot process the input which are
384           successfully used on my Linux libc based system.  Why?''
386 [A12] {UD} Unlike the author of the `gencat' program which is distributed
387 with Linux libc I have read the underlying standards before writing the
388 code.  It is completely compatible with the specification given in
389 X/Open Portability Guide.
391 To ease the transition from the Linux version some of the non-standard
392 features are also present in the `gencat' program of GNU libc.  This
393 mainly includes the use of symbols for the message number and the automatic
394 generation of header files which contain the needed #defines to map the
395 symbols to integers.
397 Here is a simple SED script to convert at least some Linux specific
398 catalog files to the XPG4 form:
400 -----------------------------------------------------------------------
401 # Change catalog source in Linux specific format to standard XPG format.
402 # Ulrich Drepper <drepper@cygnus.com>, 1996.
404 /^\$ #/ {
405   h
406   s/\$ #\([^ ]*\).*/\1/
407   x
408   s/\$ #[^ ]* *\(.*\)/\$ \1/
411 /^# / {
412   s/^# \(.*\)/\1/
413   G
414   s/\(.*\)\n\(.*\)/\2 \1/
416 -----------------------------------------------------------------------
419 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
420 [Q13]   ``How do I configure GNU libc so that the essential libraries
421           like libc.so go into /lib and the other into /usr/lib?''
423 [A13] {UD,AJ} Like all other GNU packages GNU libc is configured to
424 use a base directory and install all files relative to this.  If you
425 intend to really use GNU libc on your system this base directory is
426 /usr.  I.e., you run
427         configure --prefix=/usr <other_options>
429 Some systems like Linux have a filesystem standard which makes a
430 difference between essential libraries and others.  Essential
431 libraries are placed in /lib because this directory is required to be
432 located on the same disk partition as /.  The /usr subtree might be
433 found on another partition/disk.
435 To install the essential libraries which come with GNU libc in /lib
436 one must explicitly tell this (except on Linux, see below).  Autoconf
437 has no option for this so you have to use the file where all user
438 supplied additional information should go in: `configparms' (see the
439 `INSTALL' file).  Therefore the `configparms' file should contain:
441 slibdir=/lib
442 sysconfdir=/etc
444 The first line specifies the directory for the essential libraries,
445 the second line the directory for file which are by tradition placed
446 in a directory named /etc.
448 No rule without an exception: If you configure for Linux with
449 --prefix=/usr, then slibdir and sysconfdir will automatically be
450 defined as stated above.
453 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
454 [Q14]   ``When linking with the new libc I get unresolved symbols
455           `crypt' and `setkey'.  Why aren't these functions in the
456           libc anymore?''
458 [A14] {UD} Remember the US restrictions of exporting cryptographic
459 programs and source code.  Until this law gets abolished we cannot
460 ship the cryptographic function together with the libc.
462 But of course we provide the code and there is an very easy way to use
463 this code.  First get the extra package.  People in the US may get it
464 from the same place they got the GNU libc from.  People outside the US
465 should get the code from ftp://ftp.ifi.uio.no/pub/gnu, or another
466 archive site outside the USA.  The README explains how to install the
467 sources.
469 If you already have the crypt code on your system the reason for the
470 failure is probably that you failed to link with -lcrypt.  The crypto
471 functions are in a separate library to make it possible to export GNU
472 libc binaries from the US.
475 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
476 [Q15]   ``What are these `add-ons'?''
478 [A15] {UD} To avoid complications with export rules or external source
479 code some optional parts of the libc are distributed as separate
480 packages (e.g., the crypt package, see Q14).
482 To ease the use as part of GNU libc the installer just has to unpack
483 the package and tell the configuration script about these additional
484 subdirectories using the --enable-add-ons option.  When you add the
485 crypt add-on you just have to use
487         configure --enable-add-ons=crypt,XXX ...
489 where XXX are possible other add-ons and ... means the rest of the
490 normal option list.
492 You can use add-ons also to overwrite some files in glibc.  The add-on
493 system dependent subdirs are search first.  It is also possible to add
494 banner files (use a file named `Banner') or create shared libraries.
496 Using add-ons has the big advantage that the makefiles of the GNU libc
497 can be used.  Only some few stub rules must be written to get
498 everything running.  Even handling of architecture dependent
499 compilation is provided.  The GNU libc's sysdeps/ directory shows how
500 to use this feature.
503 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
504 [Q16]   ``When I use GNU libc on my Linux system by linking against
505           to libc.so which comes with glibc all I get is a core dump.''
507 [A16] {UD} It is not enough to simply link against the GNU libc
508 library itself.  The GNU C library comes with its own dynamic linker
509 which really conforms to the ELF API standard.  This dynamic linker
510 must be used.
512 Normally this is done by the compiler.  The gcc will use
514         -dynamic-linker /lib/ld-linux.so.1
516 unless the user specifies her/himself a -dynamic-linker argument.  But
517 this is not the correct name for the GNU dynamic linker.  The correct
518 name is /lib/ld.so.1 which is the name specified in the SVr4 ABi.
520 To change your environment to use GNU libc for compiling you need to
521 change the `specs' file of your gcc.  This file is normally found at
523         /usr/lib/gcc-lib/<arch>/<version>/specs
525 In this file you have to change a few things:
527 - change `ld-linux.so.1' to `ld.so.1' (or to ld-linux.so.2, see below)
529 - remove all expression `%{...:-lgmon}';  there is no libgmon in glibc
532 Things are getting a bit more complicated if you have GNU libc
533 installed in some other place than /usr, i.e., if you do not want to
534 use it instead of the old libc.  In this case the needed startup files
535 and libraries are not found in the regular places.  So the specs file
536 must tell the compiler and linker exactly what to use.  Here is for
537 example the gcc-2.7.2 specs file when GNU libc is installed at
538 /usr:
540 -----------------------------------------------------------------------
541 *asm:
542 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}
544 *asm_final:
545 %{pipe:-}
547 *cpp:
548 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
550 *cc1:
551 %{profile:-p}
553 *cc1plus:
556 *endfile:
557 %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s
559 *link:
560 -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static:        %{rdynamic:-export-dynamic}     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}  %{static:-static}}}
562 *lib:
563 %{!shared: %{pthread:-lpthread}         %{profile:-lc_p} %{!profile: -lc}}
565 *libgcc:
566 -lgcc
568 *startfile:
569 %{!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}
571 *switches_need_spaces:
574 *signed_char:
575 %{funsigned-char:-D__CHAR_UNSIGNED__}
577 *predefines:
578 -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
580 *cross_compile:
583 *multilib:
584 . ;
586 -----------------------------------------------------------------------
588 The above is currently correct for ix86/Linux.  Because of
589 compatibility issues on this platform the dynamic linker must have
590 a different name: ld-linux.so.2.  So you have to replace
592         %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld-linux.so.2}
594         %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld.so.1}
596 in the above example specs file to make it work for other systems.
598 Version 2.7.2.3 does and future versions of GCC will automatically
599 provide the correct specs.
602 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
603 [Q17]   ``Looking through the shared libc file I haven't found the
604           functions `stat', `lstat', `fstat', and `mknod' and while
605           linking on my Linux system I get error messages.  How is
606           this supposed to work?''
608 [A17] {RM} Believe it or not, stat and lstat (and fstat, and mknod)
609 are supposed to be undefined references in libc.so.6!  Your problem is
610 probably a missing or incorrect /usr/lib/libc.so file; note that this
611 is a small text file now, not a symlink to libc.so.6.  It should look
612 something like this:
614 GROUP ( libc.so.6 ld.so.1 libc.a )
616 or in ix86/Linux and alpha/Linux:
618 GROUP ( libc.so.6 ld-linux.so.2 libc.a )
621 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
622 [Q18]   ``The prototypes for `connect', `accept', `getsockopt',
623           `setsockopt', `getsockname', `getpeername', `send',
624           `sendto', and `recvfrom' are different in GNU libc from
625           any other system I saw.  This is a bug, isn't it?''
627 [A18] {UD} No, this is no bug.  This version of the GNU libc already
628 follows the Single Unix specifications (and I think the POSIX.1g
629 draft which adopted the solution).  The type for parameter describing
630 a size is now `socklen_t', a new type.
633 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
634 [Q19]   ``My XXX kernel emulates a floating-point coprocessor for me.
635           Should I enable --with-fp?''
637 [A19] {UD} As `configure --help' shows the default value is `yes' and
638 this should not be changed unless the FPU instructions would be
639 invalid.  I.e., an emulated FPU is for the libc as good as a real one.
642 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
643 [Q20]   ``How can I compile gcc 2.7.2.1 from the gcc source code using
644           glibc 2.x?
646 [A20] {AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3
647 or later.  You should get at least gcc 2.7.2.3.  All previous versions
648 had problems with glibc support.
651 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
652 [Q21]    ``On Linux I've got problems with the declarations in Linux
653            kernel headers.''
655 [A21] {UD,AJ} On Linux, the use of kernel headers is reduced to a very
656 minimum.  Besides giving Linus the possibility to change the headers
657 more freely it has another reason: user level programs now do not
658 always use the same types like the kernel does.
660 I.e., the libc abstracts the use of types.  E.g., the sigset_t type is
661 in the kernel 32 or 64 bits wide.  In glibc it is 1024 bits wide, in
662 preparation for future development.  The reasons are obvious: we don't
663 want to have a new major release when the Linux kernel gets these
664 functionality. Consult the headers for more information about the changes.
666 Therefore you shouldn't include Linux kernel header files directly if
667 glibc has defined a replacement. Otherwise you might get undefined
668 results because of type conflicts.
671 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
672 [Q22]   ``When I try to compile code which uses IPv6 header and
673           definitions on my Linux 2.x.y system I am in trouble.
674           Nothing seems to work.''
676 [A22] {UD} The problem is that the IPv6 development still has not reached
677 a point where it is stable.  There are still lots of incompatible changes
678 made and the libc headers have to follow.
680 Currently (as of 970401) according to Philip Blundell <philb@gnu.ai.mit.edu>
681 the required kernel version is 2.1.30.
684 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
685 [Q23]   ``When compiling GNU libc I get lots of errors saying functions
686           in glibc are duplicated in libgcc.''
688 [A23] {EY} This is *exactly* the same problem that I was having.  The
689 problem was due to the fact that the autoconfigure didn't correctly
690 detect that linker flag --no-whole-archive was supported in my linker.
691 In my case it was because I had run ./configure with bogus CFLAGS, and
692 the test failed.
694 One thing that is particularly annoying about this problem is that
695 once this is misdetected, running configure again won't fix it unless
696 you first delete config.cache.
698 {UD} Starting with glibc-2.0.3 there should be a better test to avoid
699 some problems of this kind.  The setting of CFLAGS is checked at the
700 very beginning and if it is not usable `configure' will bark.
704 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
705 [Q24]   ``I have set up /etc/nis.conf, and the Linux libc 5 with NYS
706           works great.  But the glibc NIS+ doesn't seem to work.''
708 [A24] The glibc NIS+ implementation uses a /var/nis/NIS_COLD_START
709 file for storing information about the NIS+ server and their public
710 keys, because the nis.conf file do not contain all necessary
711 information.  You have to copy a NIS_COLD_START file from a Solaris
712 client (the NIS_COLD_START file is byte order independend) or generate
713 it new with nisinit from the nis-tools (look at
714 http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
717 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
718 [Q25]   ``After installing glibc name resolving doesn't work properly.''
720 [A25] {AJ} You  probable should read the manual section describing
721 ``nsswitch.conf'' (just type `info libc "NSS Configuration File"').
722 The NSS configuration file is usually the culprit.
725 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
726 [Q26]   ``I have /usr/include/net and /usr/include/scsi as symlinks
727           into my Linux source tree.  Is that wrong?''
729 [A26] {PB} This was necessary for libc5, but is not correct when using
730 glibc.  Including the kernel header files directly in user programs
731 usually does not work (see Q21).  glibc provides its own <net/*> and
732 <scsi/*> header files to replace them, and you may have to remove any
733 symlink that you have in place before you install glibc.  However,
734 /usr/include/asm and /usr/include/linux should remain as they were.
737 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
738 [Q27]   ``Programs like `logname', `top', `uptime' `users', `w' and
739           `who', show incorrect information about the (number of)
740           users on my system.  Why?''
742 [A27] {MK} See Q10.
745 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
746 [Q28]   ``After upgrading to a glibc 2.1 with symbol versioning I get
747           errors about undefined symbols.  What went wrong?''
749 [A28] {AJ} In a versioned libc a lot of symbols are now local that
750 have been global symbols in previous versions. When defining a extern
751 variable both in a user program and extern in the libc the links
752 resolves this to only one reference - the one in the library. The
753 problem is caused by either wrong program code or tools. In no case
754 the global variables from libc should be used by any program. Since
755 these reference are now local, you might see a message like:
757 "msgfmt: error in loading shared libraries: : undefined symbol: _nl_domain_bindings"
759 The only way to fix this is to recompile your program. Sorry, that's
760 the price you might have to pay once for quite a number of advantages
761 with symbol versioning.
764 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
765 [Q29]   ``I don't include any kernel header myself but still the
766           compiler complains about type redeclarations of types in the
767           kernel headers.''
769 [A29] {UD} The kernel headers before Linux 2.1.61 don't work correctly with
770 glibc since they pollute the name space in a not acceptable way.  Compiling
771 C programs is possible in most cases but especially C++ programs have (due
772 to the change of the name lookups for `struct's) problem.  One prominent
773 example is `struct fd_set'.
775 There might be some more problems left but 2.1.61 fixes some of the known
776 ones.  See the BUGS file for other known problems.
779 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
781 Answers were given by:
782 {UD} Ulrich Drepper, <drepper@cygnus.com>
783 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
784 {RM} Roland McGrath, <roland@gnu.org>
785 {HJL} H.J. Lu, <hjl@gnu.org>
786 {AJ} Andreas Jaeger, <aj@arthur.rhein-neckar.de>
787 {EY} Eric Youngdale, <eric@andante.jic.com>
788 {PB} Phil Blundell, <Philip.Blundell@pobox.com>
789 {MK} Mark Kettenis, <kettenis@phys.uva.nl>
791 Local Variables:
792  mode:text
793 End: