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,
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.
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
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
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
78 [Q21] ``On Linux I've got problems with the declarations in Linux
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 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
98 [Q1] ``What systems does the GNU C Library run on?''
100 [A1] {UD} This is difficult to answer. The file `README' lists the
101 architectures GNU libc is known to run *at some time*. This does not
102 mean that it still can be compiled and run on them in the moment.
104 The systems glibc is known to work on in the moment and most probably
108 i[3456]86-*-linux-gnu Linux-2.0 on Intel
109 m68k-*-linux-gnu Linux-2.0 on Motorola 680x0
110 alpha-*-linux-gnu Linux-2.0 on DEC Alpha
111 powerpc-*-linux-gnu Linux and MkLinux on PowerPC systems
113 Other Linux platforms are also on the way to be supported but I need
114 some success reports first.
116 If you have a system not listed above (or in the `README' file) and
117 you are really interested in porting it, contact
119 <bug-glibc@prep.ai.mit.edu>
122 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
123 [Q2] ``What compiler do I need to build GNU libc?''
125 [A2] {UD} It is (almost) impossible to compile GNU C Library using a
126 different compiler than GNU CC. A lot of extensions of GNU CC are
127 used to increase the portability and speed.
129 But this does not mean you have to use GNU CC for using the GNU C
130 Library. In fact you should be able to use the native C compiler
131 because the success only depends on the binutils: the linker and
134 The GNU CC is found like all other GNU packages on
135 ftp://prep.ai.mit.edu/pub/gnu
136 or better one of the many mirror sites.
138 You always should try to use the latest official release. Older
139 versions might not have all the features GNU libc could use.
142 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
143 [Q3] ``When starting `make' I get only errors messages.
146 [A3] {UD} You definitely need GNU make to translate GNU libc. No
147 other make program has the needed functionality.
149 Versions before 3.74 have bugs which prevent correct execution so you
150 should upgrade to the latest version before starting the compilation.
153 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
154 [Q4] ``After I changed configure.in I get `Autoconf version X.Y.
155 or higher is required for this script'. What can I do?''
157 [A4] {UD} You have to get the specified autoconf version (or a later)
158 from your favourite mirror of prep.ai.mit.edu.
161 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
162 [Q5] ``Do I need a special linker or archiver?''
164 [A5] {UD} If your native versions are not too buggy you can probably
165 work with them. But GNU libc works best with GNU binutils.
167 On systems where the native linker does not support weak symbols you
168 will not get a really ISO C compliant C library. Generally speaking
169 you should use the GNU binutils if they provide at least the same
170 functionality as your system's tools.
172 Always get the newest release of GNU binutils available.
173 Older releases are known to have bugs that affect building the GNU C
177 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
178 [Q6] ``Do I need some more things to compile GNU C Library?''
180 [A6] {UD} Yes, there are some more :-).
182 * GNU gettext; the GNU libc is internationalized and partly localized.
183 For bringing the messages for the different languages in the needed
184 form the tools from the GNU gettext package are necessary. See
185 ftp://prep.ai.mit.edu/pub/gnu or better any mirror site.
187 * lots of diskspace (for i?86-linux this means, e.g., ~170MB; for ppc-linux
190 You should avoid compiling on a NFS mounted device. This is very
193 * plenty of time (approx 1h for i?86-linux on i586@133 or 2.5h on
194 i486@66 or 4.5h on i486@33), both for shared and static only).
195 Multiply this by 1.5 or 2.0 if you build profiling and/or the highly
196 optimized version as well. For Hurd systems times are much higher.
198 For Atari Falcon (Motorola 68030 @ 16 Mhz, 14 Mb memory) James Troup
199 <J.J.Troup@comp.brad.ac.uk> reports for a full build (shared, static,
200 and profiled) a compile time of 45h34m.
202 If you have some more measurements let me know.
204 * When compiling for Linux:
206 + the header files of the Linux kernel must be available in the
207 search path of the CPP as <linux/*.h> and <asm/*.h>.
209 * Some files depend on special tools. E.g., files ending in .gperf
210 need a `gperf' program. The GNU version (part of libg++) is known
211 to work while some vendor versions do not.
213 You should not need these tools unless you change the source files.
215 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
216 [Q7] ``When I run `nm -u libc.so' on the produced library I still
217 find unresolved symbols? Can this be ok?''
219 [A7] {UD} Yes, this is ok. There can be several kinds of unresolved
222 * magic symbols automatically generated by the linker. Names are
223 often like __start_* and __stop_*
225 * symbols starting with _dl_* come from the dynamic linker
227 * symbols resolved by using libgcc.a
228 (__udivdi3, __umoddi3, or similar)
230 * weak symbols, which need not be resolved at all
231 (currently fabs among others; this gets resolved if the program
232 is linked against libm, too.)
234 Generally, you should make sure you find a real program which produces
235 errors while linking before deciding there is a problem.
238 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
239 [Q8] ``Can I replace the libc on my Linux system with GNU libc?''
241 [A8] {UD} You cannot replace any existing libc for Linux with GNU
242 libc. There are different versions of C libraries and you can run
243 libcs with different major version independently.
245 For Linux there are today two libc versions:
246 libc-4 old a.out libc
247 libc-5 current ELF libc
249 GNU libc will have the major number 6 and therefore you can have this
250 additionally installed. For more information consult documentation for
251 shared library handling. The Makefiles of GNU libc will automatically
252 generate the needed symbolic links which the linker will use.
255 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
256 [Q9] ``I expect GNU libc to be 100% source code compatible with
257 the old Linux based GNU libc. Why isn't it like this?''
259 [A9] {DMT,UD} Not every extension in Linux libc's history was well
260 thought-out. In fact it had a lot of problems with standards compliance
261 and with cleanliness. With the introduction of a new version number these
262 errors now can be corrected. Here is a list of the known source code
265 * _GNU_SOURCE: glibc does not automatically define _GNU_SOURCE. Thus,
266 if a program depends on GNU extensions or some other non-standard
267 functionality, it is necessary to compile it with C compiler option
268 -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at the beginning
269 of your source files, before any C library header files are included.
270 This difference normally manifests itself in the form of missing
271 prototypes and/or data type definitions. Thus, if you get such errors,
272 the first thing you should do is try defining _GNU_SOURCE and see if
273 that makes the problem go away.
275 For more information consult the file `NOTES' part of the GNU C
278 * reboot(): GNU libc sanitizes the interface of reboot() to be more
279 compatible with the interface used on other OSes. In particular,
280 reboot() as implemented in glibc takes just one argument. This argument
281 corresponds to the third argument of the Linux reboot system call.
282 That is, a call of the form reboot(a, b, c) needs to be changed into
284 Beside this the header <sys/reboot.h> defines the needed constants
285 for the argument. These RB_* constants should be used instead of the
286 cryptic magic numbers.
288 * swapon(): the interface of this function didn't changed, but the
289 prototype is in a separate header file <sys/swap.h>. For the additional
290 argument of swapon() you should use the SWAP_* constants from
291 <linux/swap.h>, which get defined when <sys/swap.h> is included.
293 * errno: If a program uses variable "errno", then it _must_ include header
294 file <errno.h>. The old libc often (erroneously) declared this variable
295 implicitly as a side-effect of including other libc header files. glibc
296 is careful to avoid such namespace pollution, which, in turn, means that
297 you really need to include the header files that you depend on. This
298 difference normally manifests itself in the form of the compiler
299 complaining about the references of the undeclared symbol "errno".
301 * Linux-specific syscalls: All Linux system calls now have appropriate
302 library wrappers and corresponding declarations in various header files.
303 This is because the syscall() macro that was traditionally used to
304 work around missing syscall wrappers are inherently non-portable and
305 error-prone. The following tables lists all the new syscall stubs,
306 the header-file declaring their interface and the system call name.
308 syscall name: wrapper name: declaring header file:
309 ------------- ------------- ----------------------
310 bdflush bdflush <sys/kdaemon.h>
311 create_module create_module <sys/module.h>
312 delete_module delete_module <sys/module.h>
313 get_kernel_syms get_kernel_syms <sys/module.h>
314 init_module init_module <sys/module.h>
315 syslog ksyslog_ctl <sys/klog.h>
317 * lpd: Older versions of lpd depend on a routine called _validuser().
318 The library does not provide this function, but instead provides
319 __ivaliduser() which has a slightly different interfaces. Simply
320 upgrading to a newer lpd should fix this problem (e.g., the 4.4BSD
321 lpd is known to be working).
323 * resolver functions/BIND: like on many other systems the functions of
324 the resolver library are not included in the libc itself. There is
325 a separate library libresolv. If you find some symbols starting with
326 `res_*' undefined simply add -lresolv to your call of the linker.
328 * the `signal' function's behaviour corresponds to the BSD semantic and
329 not the SysV semantic as it was in libc-5. The interface on all GNU
330 systems shall be the same and BSD is the semantic of choice. To use
331 the SysV behaviour simply use `sysv_signal'. The major difference is
332 that the SysV implementation sets the SA_ONESHOT flag and so the handler
333 gets removed after the first call.
336 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
337 [Q10] ``Why does getlogin() always return NULL on my Linux box?''
339 [A10] {UD} The GNU C library has a format for the UTMP and WTMP file
340 which differs from what your system currently has. It was extended to
341 fulfill the needs of the next years when IPv6 is introduced. So the
342 record size is different, fields might have a different position and
343 so reading the files written by functions from the one library cannot
344 be read by functions from the other library. Sorry, but this is what
345 a major release is for. It's better to have a cut now than having no
346 means to support the new techniques later.
349 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
350 [Q11] ``Where are the DST_* constants found in <sys/time.h> on many
353 [A11] {UD} These constants come from the old BSD days and are not used
354 today anymore (even the Linux based glibc does not implement the handling
355 although the constants are defined).
357 Instead GNU libc contains the zone database handling and compatibility
358 code for POSIX TZ environment variable handling.
361 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
362 [Q12] ``The `gencat' utility cannot process the input which are
363 successfully used on my Linux libc based system. Why?''
365 [A12] {UD} Unlike the author of the `gencat' program which is distributed
366 with Linux libc I have read the underlying standards before writing the
367 code. It is completely compatible with the specification given in
368 X/Open Portability Guide.
370 To ease the transition from the Linux version some of the non-standard
371 features are also present in the `gencat' program of GNU libc. This
372 mainly includes the use of symbols for the message number and the automatic
373 generation of header files which contain the needed #defines to map the
376 Here is a simple SED script to convert at least some Linux specific
377 catalog files to the XPG4 form:
379 -----------------------------------------------------------------------
380 # Change catalog source in Linux specific format to standard XPG format.
381 # Ulrich Drepper <drepper@cygnus.com>, 1996.
385 s/\$ #\([^ ]*\).*/\1/
387 s/\$ #[^ ]* *\(.*\)/\$ \1/
393 s/\(.*\)\n\(.*\)/\2 \1/
395 -----------------------------------------------------------------------
398 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
399 [Q13] ``How do I configure GNU libc so that the essential libraries
400 like libc.so go into /lib and the other into /usr/lib?''
402 [A13] {UD,AJ} Like all other GNU packages GNU libc is configured to
403 use a base directory and install all files relative to this. If you
404 intend to really use GNU libc on your system this base directory is
406 configure --prefix=/usr <other_options>
408 Some systems like Linux have a filesystem standard which makes a
409 difference between essential libraries and others. Essential
410 libraries are placed in /lib because this directory is required to be
411 located on the same disk partition as /. The /usr subtree might be
412 found on another partition/disk.
414 To install the essential libraries which come with GNU libc in /lib
415 one must explicitly tell this (except on Linux, see below). Autoconf
416 has no option for this so you have to use the file where all user
417 supplied additional information should go in: `configparms' (see the
418 `INSTALL' file). Therefore the `configparms' file should contain:
423 The first line specifies the directory for the essential libraries,
424 the second line the directory for file which are by tradition placed
425 in a directory named /etc.
427 No rule without an exception: If you configure for Linux with
428 --prefix=/usr, then slibdir and sysconfdir will automatically be
429 defined as stated above.
432 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
433 [Q14] ``When linking with the new libc I get unresolved symbols
434 `crypt' and `setkey'. Why aren't these functions in the
437 [A14] {UD} Remember the US restrictions of exporting cryptographic
438 programs and source code. Until this law gets abolished we cannot
439 ship the cryptographic function together with the libc.
441 But of course we provide the code and there is an very easy way to use
442 this code. First get the extra package. People in the US may get it
443 from the same place they got the GNU libc from. People outside the US
444 should get the code from ftp://ftp.ifi.uio.no/pub/gnu, or another
445 archive site outside the USA. The README explains how to install the
448 If you already have the crypt code on your system the reason for the
449 failure is probably that you failed to link with -lcrypt. The crypto
450 functions are in a separate library to make it possible to export GNU
451 libc binaries from the US.
454 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
455 [Q15] ``What are these `add-ons'?''
457 [A15] {UD} To avoid complications with export rules or external source
458 code some optional parts of the libc are distributed as separate
459 packages (e.g., the crypt package, see Q14).
461 To ease the use as part of GNU libc the installer just has to unpack
462 the package and tell the configuration script about these additional
463 subdirectories using the --enable-add-ons option. When you add the
464 crypt add-on you just have to use
466 configure --enable-add-ons=crypt,XXX ...
468 where XXX are possible other add-ons and ... means the rest of the
471 You can use add-ons also to overwrite some files in glibc. The add-on
472 system dependent subdirs are search first. It is also possible to add
473 banner files (use a file named `Banner') or create shared libraries.
475 Using add-ons has the big advantage that the makefiles of the GNU libc
476 can be used. Only some few stub rules must be written to get
477 everything running. Even handling of architecture dependent
478 compilation is provided. The GNU libc's sysdeps/ directory shows how
482 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
483 [Q16] ``When I use GNU libc on my Linux system by linking against
484 to libc.so which comes with glibc all I get is a core dump.''
486 [A16] {UD} It is not enough to simply link against the GNU libc
487 library itself. The GNU C library comes with its own dynamic linker
488 which really conforms to the ELF API standard. This dynamic linker
491 Normally this is done by the compiler. The gcc will use
493 -dynamic-linker /lib/ld-linux.so.1
495 unless the user specifies her/himself a -dynamic-linker argument. But
496 this is not the correct name for the GNU dynamic linker. The correct
497 name is /lib/ld.so.1 which is the name specified in the SVr4 ABi.
499 To change your environment to use GNU libc for compiling you need to
500 change the `specs' file of your gcc. This file is normally found at
502 /usr/lib/gcc-lib/<arch>/<version>/specs
504 In this file you have to change a few things:
506 - change `ld-linux.so.1' to `ld.so.1' (or to ld-linux.so.2, see below)
508 - remove all expression `%{...:-lgmon}'; there is no libgmon in glibc
511 Things are getting a bit more complicated if you have GNU libc
512 installed in some other place than /usr, i.e., if you do not want to
513 use it instead of the old libc. In this case the needed startup files
514 and libraries are not found in the regular places. So the specs file
515 must tell the compiler and linker exactly what to use. Here is for
516 example the gcc-2.7.2 specs file when GNU libc is installed at
519 -----------------------------------------------------------------------
521 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}
527 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
536 %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s
539 -m elf_i386 %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} %{static:-static}}}
542 %{!shared: %{pthread:-lpthread} %{profile:-lc_p} %{!profile: -lc}}
548 %{!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}
550 *switches_need_spaces:
554 %{funsigned-char:-D__CHAR_UNSIGNED__}
557 -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
565 -----------------------------------------------------------------------
567 The above is currently correct for ix86/Linux. Because of
568 compatibility issues on this platform the dynamic linker must have
569 a different name: ld-linux.so.2. So you have to replace
571 %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld-linux.so.2}
573 %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld.so.1}
575 in the above example specs file to make it work for other systems.
577 Version 2.7.2.3 does and future versions of GCC will automatically
578 provide the correct specs.
581 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
582 [Q17] ``Looking through the shared libc file I haven't found the
583 functions `stat', `lstat', `fstat', and `mknod' and while
584 linking on my Linux system I get error messages. How is
585 this supposed to work?''
587 [A17] {RM} Believe it or not, stat and lstat (and fstat, and mknod)
588 are supposed to be undefined references in libc.so.6! Your problem is
589 probably a missing or incorrect /usr/lib/libc.so file; note that this
590 is a small text file now, not a symlink to libc.so.6. It should look
593 GROUP ( libc.so.6 ld.so.1 libc.a )
595 or in ix86/Linux and alpha/Linux:
597 GROUP ( libc.so.6 ld-linux.so.2 libc.a )
600 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
601 [Q18] ``The prototypes for `connect', `accept', `getsockopt',
602 `setsockopt', `getsockname', `getpeername', `send',
603 `sendto', and `recvfrom' are different in GNU libc from
604 any other system I saw. This is a bug, isn't it?''
606 [A18] {UD} No, this is no bug. This version of the GNU libc already
607 follows the Single Unix specifications (and I think the POSIX.1g
608 draft which adopted the solution). The type for parameter describing
609 a size is now `socklen_t', a new type.
612 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
613 [Q19] ``My XXX kernel emulates a floating-point coprocessor for me.
614 Should I enable --with-fp?''
616 [A19] {UD} As `configure --help' shows the default value is `yes' and
617 this should not be changed unless the FPU instructions would be
618 invalid. I.e., an emulated FPU is for the libc as good as a real one.
621 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
622 [Q20] ``How can I compile gcc 2.7.2.1 from the gcc source code using
625 [A20] {AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3
626 or later. You should get at least gcc 2.7.2.3. All previous versions
627 had problems with glibc support.
630 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
631 [Q21] ``On Linux I've got problems with the declarations in Linux
634 [A21] {UD,AJ} On Linux, the use of kernel headers is reduced to a very
635 minimum. Besides giving Linus the possibility to change the headers
636 more freely it has another reason: user level programs now do not
637 always use the same types like the kernel does.
639 I.e., the libc abstracts the use of types. E.g., the sigset_t type is
640 in the kernel 32 or 64 bits wide. In glibc it is 1024 bits wide, in
641 preparation for future development. The reasons are obvious: we don't
642 want to have a new major release when the Linux kernel gets these
643 functionality. Consult the headers for more information about the changes.
645 Therefore you shouldn't include Linux kernel header files directly if
646 glibc has defined a replacement. Otherwise you might get undefined
647 results because of type conflicts.
650 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
651 [Q22] ``When I try to compile code which uses IPv6 header and
652 definitions on my Linux 2.x.y system I am in trouble.
653 Nothing seems to work.''
655 [A22] {UD} The problem is that the IPv6 development still has not reached
656 a point where it is stable. There are still lots of incompatible changes
657 made and the libc headers have to follow.
659 Currently (as of 970401) according to Philip Blundell <philb@gnu.ai.mit.edu>
660 the required kernel version is 2.1.30.
663 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
664 [Q23] ``When compiling GNU libc I get lots of errors saying functions
665 in glibc are duplicated in libgcc.''
667 [A23] {EY} This is *exactly* the same problem that I was having. The
668 problem was due to the fact that the autoconfigure didn't correctly
669 detect that linker flag --no-whole-archive was supported in my linker.
670 In my case it was because I had run ./configure with bogus CFLAGS, and
673 One thing that is particularly annoying about this problem is that
674 once this is misdetected, running configure again won't fix it unless
675 you first delete config.cache.
677 {UD} Starting with glibc-2.0.3 there should be a better test to avoid
678 some problems of this kind. The setting of CFLAGS is checked at the
679 very beginning and if it is not usable `configure' will bark.
683 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
684 [Q24] ``I have set up /etc/nis.conf, and the Linux libc 5 with NYS
685 works great. But the glibc NIS+ doesn't seem to work.''
687 [A24] The glibc NIS+ implementation uses a /var/nis/NIS_COLD_START
688 file for storing information about the NIS+ server and their public
689 keys, because the nis.conf file do not contain all necessary
690 information. You have to copy a NIS_COLD_START file from a Solaris
691 client (the NIS_COLD_START file is byte order independend) or generate
692 it new with nisinit from the nis-tools (look at
693 http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
696 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
697 [Q25] ``After installing glibc name resolving doesn't work properly.''
699 [A25] {AJ} You probable should read the manual section describing
700 ``nsswitch.conf'' (just type `info libc "NSS Configuration File"').
701 The NSS configuration file is usually the culprit.
704 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
705 [Q26] ``I have /usr/include/net and /usr/include/scsi as symlinks
706 into my Linux source tree. Is that wrong?''
708 [A26] {PB} This was necessary for libc5, but is not correct when using
709 glibc. Including the kernel header files directly in user programs
710 usually does not work (see Q21). glibc provides its own <net/*> and
711 <scsi/*> header files to replace them, and you may have to remove any
712 symlink that you have in place before you install glibc. However,
713 /usr/include/asm and /usr/include/linux should remain as they were.
716 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
718 Answers were given by:
719 {UD} Ulrich Drepper, <drepper@cygnus.com>
720 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
721 {RM} Roland McGrath, <roland@gnu.ai.mit.edu>
722 {HJL} H.J. Lu, <hjl@gnu.ai.mit.edu>
723 {AJ} Andreas Jaeger, <aj@arthur.rhein-neckar.de>
724 {EY} Eric Youngdale, <eric@andante.jic.com>
725 {PB} Phil Blundell, <Philip.Blundell@pobox.com>