Update.
[platform/upstream/glibc.git] / FAQ
1                 Frequently Asked Question on GNU C Library
2
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.
6
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.
13
14 If you have any questions you think should be answered in this document,
15 please let me know.
16
17                                                   --drepper@cygnus.com
18 \f
19 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
20 [Q1]    ``What systems does the GNU C Library run on?''
21
22 [Q2]    ``What compiler do I need to build GNU libc?''
23
24 [Q3]    ``When starting make I get only error messages.
25           What's wrong?''
26
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?''
29
30 [Q5]    ``Do I need a special linker or archiver?''
31
32 [Q6]    ``Do I need some more things to compile GNU C Library?''
33
34 [Q7]    ``When I run `nm -u libc.so' on the produced library I still
35           find unresolved symbols?  Can this be ok?''
36
37 [Q8]    ``Can I replace the libc on my Linux system with GNU libc?''
38
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?''
41
42 [Q10]   ``Why does getlogin() always return NULL on my Linux box?''
43
44 [Q11]   ``Where are the DST_* constants found in <sys/time.h> on many
45           systems?''
46
47 [Q12]   ``The `gencat' utility cannot process the input which are
48           successfully used on my Linux libc based system.  Why?''
49
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?''
52
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?''
56
57 [Q15]   ``What are these `add-ons'?''
58
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.''
61
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?''
66
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?''
71
72 [Q19]   ``My XXX kernel emulates a floating-point coprocessor for me.
73           Should I enable --with-fp?''
74
75 [Q20]   ``How can I compile gcc 2.7.2.1 from the gcc source code using
76           glibc 2.x?
77
78 [Q21]    ``On Linux I've got problems with the declarations in Linux
79            kernel headers.''
80
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.''
84
85 [Q23]   ``When compiling GNU libc I get lots of errors saying functions
86           in glibc are duplicated in libgcc.''
87
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.''
90 \f
91 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
92 [Q1]    ``What systems does the GNU C Library run on?''
93
94 [A1] {UD} This is difficult to answer.  The file `README' lists the
95 architectures GNU libc is known to run *at some time*.  This does not
96 mean that it still can be compiled and run on them in the moment.
97
98 The systems glibc is known to work on in the moment and most probably
99 in the future are:
100
101         *-*-gnu                 GNU Hurd
102         i[3456]86-*-linux-gnu   Linux-2.0 on Intel
103         m68k-*-linux-gnu        Linux-2.0 on Motorola 680x0
104         alpha-*-linux-gnu       Linux-2.0 on DEC Alpha
105
106 Other Linux platforms are also on the way to be supported but I need
107 some success reports first.
108
109 If you have a system not listed above (or in the `README' file) and
110 you are really interested in porting it, contact
111
112         <bug-glibc@prep.ai.mit.edu>
113
114
115 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
116 [Q2]    ``What compiler do I need to build GNU libc?''
117
118 [A2] {UD} It is (almost) impossible to compile GNU C Library using a
119 different compiler than GNU CC.  A lot of extensions of GNU CC are
120 used to increase the portability and speed.
121
122 But this does not mean you have to use GNU CC for using the GNU C
123 Library.  In fact you should be able to use the native C compiler
124 because the success only depends on the binutils: the linker and
125 archiver.
126
127 The GNU CC is found like all other GNU packages on
128         ftp://prep.ai.mit.edu/pub/gnu
129 or better one of the many mirror sites.
130
131 You always should try to use the latest official release.  Older
132 versions might not have all the features GNU libc could use.
133
134
135 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
136 [Q3]    ``When starting `make' I get only errors messages.
137           What's wrong?''
138
139 [A3] {UD} You definitely need GNU make to translate GNU libc.  No
140 other make program has the needed functionality.
141
142 Versions before 3.74 have bugs which prevent correct execution so you
143 should upgrade to the latest version before starting the compilation.
144
145
146 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
147 [Q4]    ``After I changed configure.in I get `Autoconf version X.Y.
148           or higher is required for this script'.  What can I do?''
149
150 [A4] {UD} You have to get the specified autoconf version (or a later)
151 from your favourite mirror of prep.ai.mit.edu.
152
153
154 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
155 [Q5]    ``Do I need a special linker or archiver?''
156
157 [A5] {UD} If your native versions are not too buggy you can probably
158 work with them.  But GNU libc works best with GNU binutils.
159
160 On systems where the native linker does not support weak symbols you
161 will not get a really ISO C compliant C library.  Generally speaking
162 you should use the GNU binutils if they provide at least the same
163 functionality as your system's tools.
164
165 Always get the newest release of GNU binutils available.
166 Older releases are known to have bugs that affect building the GNU C
167 Library.
168
169
170 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
171 [Q6]    ``Do I need some more things to compile GNU C Library?''
172
173 [A6] {UD} Yes, there are some more :-).
174
175 * GNU gettext; the GNU libc is internationalized and partly localized.
176   For bringing the messages for the different languages in the needed
177   form the tools from the GNU gettext package are necessary.  See
178   ftp://prep.ai.mit.edu/pub/gnu or better any mirror site.
179
180 * lots of diskspace (for i?86-linux this means, e.g., ~70MB).
181
182   You should avoid compiling on a NFS mounted device.  This is very
183   slow.
184
185 * plenty of time (approx 1h for i?86-linux on i586@133 or 2.5h on
186   i486@66 or 4.5h on i486@33), both for shared and static only).
187   For Hurd systems times are much higher.
188
189   For Atari Falcon (Motorola 68030 @ 16 Mhz, 14 Mb memory) James Troup
190   <J.J.Troup@comp.brad.ac.uk> reports for a full build (shared, static,
191   and profiled) a compile time of 45h34m.
192
193   If you have some more measurements let me know.
194
195 * When compiling for Linux:
196
197   + the header files of the Linux kernel must be available in the
198     search path of the CPP as <linux/*.h> and <asm/*.h>.
199
200 * Some files depend on special tools.  E.g., files ending in .gperf
201   need a `gperf' program.  The GNU version (part of libg++) is known
202   to work while some vendor versions do not.
203
204   You should not need these tools unless you change the source files.
205
206 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
207 [Q7]    ``When I run `nm -u libc.so' on the produced library I still
208           find unresolved symbols?  Can this be ok?''
209
210 [A7] {UD} Yes, this is ok.  There can be several kinds of unresolved
211 symbols:
212
213 * magic symbols automatically generated by the linker.  Names are
214   often like __start_* and __stop_*
215
216 * symbols starting with _dl_* come from the dynamic linker
217
218 * symbols resolved by using libgcc.a
219   (__udivdi3, __umoddi3, or similar)
220
221 * weak symbols, which need not be resolved at all
222   (currently fabs among others; this gets resolved if the program
223    is linked against libm, too.)
224
225 Generally, you should make sure you find a real program which produces
226 errors while linking before deciding there is a problem.
227
228
229 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
230 [Q8]    ``Can I replace the libc on my Linux system with GNU libc?''
231
232 [A8] {UD} You cannot replace any existing libc for Linux with GNU
233 libc.  There are different versions of C libraries and you can run
234 libcs with different major version independently.
235
236 For Linux there are today two libc versions:
237         libc-4          old a.out libc
238         libc-5          current ELF libc
239
240 GNU libc will have the major number 6 and therefore you can have this
241 additionally installed.  For more information consult documentation for
242 shared library handling.  The Makefiles of GNU libc will automatically
243 generate the needed symbolic links which the linker will use.
244
245
246 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
247 [Q9]    ``I expect GNU libc to be 100% source code compatible with
248           the old Linux based GNU libc.  Why isn't it like this?''
249
250 [A9] {DMT,UD} Not every extension in Linux libc's history was well
251 thought-out.  In fact it had a lot of problems with standards compliance
252 and with cleanliness.  With the introduction of a new version number these
253 errors now can be corrected.  Here is a list of the known source code
254 incompatibilities:
255
256 * _GNU_SOURCE: glibc does not automatically define _GNU_SOURCE.  Thus,
257   if a program depends on GNU extensions or some other non-standard
258   functionality, it is necessary to compile it with C compiler option
259   -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at the beginning
260   of your source files, before any C library header files are included.
261   This difference normally manifests itself in the form of missing
262   prototypes and/or data type definitions.  Thus, if you get such errors,
263   the first thing you should do is try defining _GNU_SOURCE and see if
264   that makes the problem go away.
265
266   For more information consult the file `NOTES' part of the GNU C
267   library sources.
268
269 * reboot(): GNU libc sanitizes the interface of reboot() to be more
270   compatible with the interface used on other OSes.  In particular,
271   reboot() as implemented in glibc takes just one argument.  This argument
272   corresponds to the third argument of the Linux reboot system call.
273   That is, a call of the form reboot(a, b, c) needs to be changed into
274   reboot(c).
275      Beside this the header <sys/reboot.h> defines the needed constants
276   for the argument.  These RB_* constants should be used instead of the
277   cryptic magic numbers.
278
279 * swapon(): the interface of this function didn't changed, but the
280   prototype is in a separate header file <sys/swap.h>.  For the additional
281   argument of swapon() you should use the SWAP_* constants from
282   <linux/swap.h>, which get defined when <sys/swap.h> is included.
283
284 * errno: If a program uses variable "errno", then it _must_ include header
285   file <errno.h>.  The old libc often (erroneously) declared this variable
286   implicitly as a side-effect of including other libc header files.  glibc
287   is careful to avoid such namespace pollution, which, in turn, means that
288   you really need to include the header files that you depend on.  This
289   difference normally manifests itself in the form of the compiler
290   complaining about the references of the undeclared symbol "errno".
291
292 * Linux-specific syscalls: All Linux system calls now have appropriate
293   library wrappers and corresponding declarations in various header files.
294   This is because the syscall() macro that was traditionally used to
295   work around missing syscall wrappers are inherently non-portable and
296   error-prone.  The following tables lists all the new syscall stubs,
297   the header-file declaring their interface and the system call name.
298
299        syscall name:    wrapper name:   declaring header file:
300        -------------    -------------   ----------------------
301        bdflush          bdflush         <sys/kdaemon.h>
302        create_module    create_module   <sys/module.h>
303        delete_module    delete_module   <sys/module.h>
304        get_kernel_syms  get_kernel_syms <sys/module.h>
305        init_module      init_module     <sys/module.h>
306        syslog           ksyslog_ctl     <sys/klog.h>
307
308 * lpd: Older versions of lpd depend on a routine called _validuser().
309   The library does not provide this function, but instead provides
310   __ivaliduser() which has a slightly different interfaces.  Simply
311   upgrading to a newer lpd should fix this problem (e.g., the 4.4BSD
312   lpd is known to be working).
313
314 * resolver functions/BIND: like on many other systems the functions of
315   the resolver library are not included in the libc itself.  There is
316   a separate library libresolv.  If you find some symbols starting with
317   `res_*' undefined simply add -lresolv to your call of the linker.
318
319 * the `signal' function's behaviour corresponds to the BSD semantic and
320   not the SysV semantic as it was in libc-5.  The interface on all GNU
321   systems shall be the same and BSD is the semantic of choice.  To use
322   the SysV behaviour simply use `sysv_signal'.  The major difference is
323   that the SysV implementation sets the SA_ONESHOT flag and so the handler
324   gets removed after the first call.
325
326
327 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
328 [Q10]   ``Why does getlogin() always return NULL on my Linux box?''
329
330 [A10] {UD} The GNU C library has a format for the UTMP and WTMP file
331 which differs from what your system currently has.  It was extended to
332 fulfill the needs of the next years when IPv6 is introduced.  So the
333 record size is different, fields might have a different position and
334 so reading the files written by functions from the one library cannot
335 be read by functions from the other library.  Sorry, but this is what
336 a major release is for.  It's better to have a cut now than having no
337 means to support the new techniques later.
338
339
340 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
341 [Q11]   ``Where are the DST_* constants found in <sys/time.h> on many
342           systems?''
343
344 [A11] {UD} These constants come from the old BSD days and are not used
345 today anymore (even the Linux based glibc does not implement the handling
346 although the constants are defined).
347
348 Instead GNU libc contains the zone database handling and compatibility
349 code for POSIX TZ environment variable handling.
350
351
352 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
353 [Q12]   ``The `gencat' utility cannot process the input which are
354           successfully used on my Linux libc based system.  Why?''
355
356 [A12] {UD} Unlike the author of the `gencat' program which is distributed
357 with Linux libc I have read the underlying standards before writing the
358 code.  It is completely compatible with the specification given in
359 X/Open Portability Guide.
360
361 To ease the transition from the Linux version some of the non-standard
362 features are also present in the `gencat' program of GNU libc.  This
363 mainly includes the use of symbols for the message number and the automatic
364 generation of header files which contain the needed #defines to map the
365 symbols to integers.
366
367 Here is a simple SED script to convert at least some Linux specific
368 catalog files to the XPG4 form:
369
370 -----------------------------------------------------------------------
371 # Change catalog source in Linux specific format to standard XPG format.
372 # Ulrich Drepper <drepper@cygnus.com>, 1996.
373 #
374 /^\$ #/ {
375   h
376   s/\$ #\([^ ]*\).*/\1/
377   x
378   s/\$ #[^ ]* *\(.*\)/\$ \1/
379 }
380
381 /^# / {
382   s/^# \(.*\)/\1/
383   G
384   s/\(.*\)\n\(.*\)/\2 \1/
385 }
386 -----------------------------------------------------------------------
387
388
389 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
390 [Q13]   ``How do I configure GNU libc so that the essential libraries
391           like libc.so go into /lib and the other into /usr/lib?''
392
393 [A13] {UD,AJ} Like all other GNU packages GNU libc is configured to
394 use a base directory and install all files relative to this.  If you
395 intend to really use GNU libc on your system this base directory is
396 /usr.  I.e., you run
397         configure --prefix=/usr <other_options>
398
399 Some systems like Linux have a filesystem standard which makes a
400 difference between essential libraries and others.  Essential
401 libraries are placed in /lib because this directory is required to be
402 located on the same disk partition as /.  The /usr subtree might be
403 found on another partition/disk.
404
405 To install the essential libraries which come with GNU libc in /lib
406 one must explicitly tell this (except on Linux, see below).  Autoconf
407 has no option for this so you have to use the file where all user
408 supplied additional information should go in: `configparms' (see the
409 `INSTALL' file).  Therefore the `configparms' file should contain:
410
411 slibdir=/lib
412 sysconfdir=/etc
413
414 The first line specifies the directory for the essential libraries,
415 the second line the directory for file which are by tradition placed
416 in a directory named /etc.
417
418 No rule without an exception: If you configure for Linux with
419 --prefix=/usr, then slibdir and sysconfdir will automatically be
420 defined as stated above.
421
422
423 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
424 [Q14]   ``When linking with the new libc I get unresolved symbols
425           `crypt' and `setkey'.  Why aren't these functions in the
426           libc anymore?''
427
428 [A14] {UD} Remember the US restrictions of exporting cryptographic
429 programs and source code.  Until this law gets abolished we cannot
430 ship the cryptographic function together with the libc.
431
432 But of course we provide the code and there is an very easy way to use
433 this code.  First get the extra package.  People in the US way get it
434 from the same place they got the GNU libc from.  People outside the US
435 should get the code from ftp://ftp.ifi.uio.no/pub/gnu, or another
436 archive site outside the USA.  The README explains how to install the
437 sources.
438
439 If you already have the crypt code on your system the reason for the
440 failure is probably that you failed to link with -lcrypt.  The crypto
441 functions are in a separate library to make it possible to export GNU
442 libc binaries from the US.
443
444
445 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
446 [Q15]   ``What are these `add-ons'?''
447
448 [A15] {UD} To avoid complications with export rules or external source
449 code some optional parts of the libc are distributed as separate
450 packages (e.g., the crypt package, see Q14).
451
452 To ease the use as part of GNU libc the installer just has to unpack
453 the package and tell the configuration script about these additional
454 subdirectories using the --enable-add-ons option.  When you add the
455 crypt add-on you just have to use
456
457         configure --enable-add-ons=crypt,XXX ...
458
459 where XXX are possible other add-ons and ... means the rest of the
460 normal option list.
461
462 You can use add-ons also to overwrite some files in glibc.  The add-on
463 system dependent subdirs are search first.  It is also possible to add
464 banner files (use a file named `Banner') or create shared libraries.
465
466 Using add-ons has the big advantage that the makefiles of the GNU libc
467 can be used.  Only some few stub rules must be written to get
468 everything running.  Even handling of architecture dependent
469 compilation is provided.  The GNU libc's sysdeps/ directory shows how
470 to use this feature.
471
472
473 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
474 [Q16]   ``When I use GNU libc on my Linux system by linking against
475           to libc.so which comes with glibc all I get is a core dump.''
476
477 [A16] {UD} It is not enough to simply link against the GNU libc
478 library itself.  The GNU C library comes with its own dynamic linker
479 which really conforms to the ELF API standard.  This dynamic linker
480 must be used.
481
482 Normally this is done by the compiler.  The gcc will use
483
484         -dynamic-linker /lib/ld-linux.so.1
485
486 unless the user specifies her/himself a -dynamic-linker argument.  But
487 this is not the correct name for the GNU dynamic linker.  The correct
488 name is /lib/ld.so.1 which is the name specified in the SVr4 ABi.
489
490 To change your environment to use GNU libc for compiling you need to
491 change the `specs' file of your gcc.  This file is normally found at
492
493         /usr/lib/gcc-lib/<arch>/<version>/specs
494
495 In this file you have to change a few things:
496
497 - change `ld-linux.so.1' to `ld.so.1' (or to ld-linux.so.2, see below)
498
499 - remove all expression `%{...:-lgmon}';  there is no libgmon in glibc
500
501
502 Things are getting a bit more complicated if you have GNU libc
503 installed in some other place than /usr, i.e., if you do not want to
504 use it instead of the old libc.  In this case the needed startup files
505 and libraries are not found in the regular places.  So the specs file
506 must tell the compiler and linker exactly what to use.  Here is for
507 example the gcc-2.7.2 specs file when GNU libc is installed at
508 /usr:
509
510 -----------------------------------------------------------------------
511 *asm:
512 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}
513
514 *asm_final:
515 %{pipe:-}
516
517 *cpp:
518 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
519
520 *cc1:
521 %{profile:-p}
522
523 *cc1plus:
524
525
526 *endfile:
527 %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s
528
529 *link:
530 -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static:        %{rdynamic:-export-dynamic}     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}  %{static:-static}}}
531
532 *lib:
533 %{!shared: %{pthread:-lpthread}         %{profile:-lc_p} %{!profile: -lc}}
534
535 *libgcc:
536 -lgcc
537
538 *startfile:
539 %{!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}
540
541 *switches_need_spaces:
542
543
544 *signed_char:
545 %{funsigned-char:-D__CHAR_UNSIGNED__}
546
547 *predefines:
548 -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
549
550 *cross_compile:
551 0
552
553 *multilib:
554 . ;
555
556 -----------------------------------------------------------------------
557
558 The above is currently correct for ix86/Linux.  Because of
559 compatibility issues on this platform the dynamic linker must have
560 a different name: ld-linux.so.2.  So you have to replace
561
562         %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld-linux.so.2}
563 by
564         %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld.so.1}
565
566 in the above example specs file to make it work for other systems.
567
568 Version 2.7.2.2 does and future versions of GCC will automatically
569 provide the correct specs.
570
571
572 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
573 [Q17]   ``Looking through the shared libc file I haven't found the
574           functions `stat', `lstat', `fstat', and `mknod' and while
575           linking on my Linux system I get error messages.  How is
576           this supposed to work?''
577
578 [A17] {RM} Believe it or not, stat and lstat (and fstat, and mknod)
579 are supposed to be undefined references in libc.so.6!  Your problem is
580 probably a missing or incorrect /usr/lib/libc.so file; note that this
581 is a small text file now, not a symlink to libc.so.6.  It should look
582 something like this:
583
584 GROUP ( libc.so.6 ld.so.1 libc.a )
585
586 or in ix86/Linux and alpha/Linux:
587
588 GROUP ( libc.so.6 ld-linux.so.2 libc.a )
589
590
591 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
592 [Q18]   ``The prototypes for `connect', `accept', `getsockopt',
593           `setsockopt', `getsockname', `getpeername', `send',
594           `sendto', and `recvfrom' are different in GNU libc from
595           any other system I saw.  This is a bug, isn't it?''
596
597 [A18] {UD} No, this is no bug.  This version of the GNU libc already
598 follows the to-be-released POSIX.1g standard.  In this standard
599 the type `size_t' is used for all parameters which describe a size.
600 So better change now.
601
602 This change is critical for system which have
603         sizeof (int) != sizeof (size_t)
604 like the Alpha.
605
606
607 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
608 [Q19]   ``My XXX kernel emulates a floating-point coprocessor for me.
609           Should I enable --with-fp?''
610
611 [A19] {UD} As `configure --help' shows the default value is `yes' and
612 this should not be changed unless the FPU instructions would be
613 invalid.  I.e., an emulated FPU is for the libc as good as a real one.
614
615
616 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
617 [Q20]   ``How can I compile gcc 2.7.2.1 from the gcc source code using
618           glibc 2.x?
619
620 [A20] {AJ} There's only support for glibc 2.0 in gcc 2.7.2.2 or later.
621 For 2.7.2.2 you should use the following patch and configure for
622 e.g. i486-linux.
623 -----------------------------------------------------------------------
624 --- configure       Tue Feb 11 15:57:17 1997
625 +++ configure   Wed Feb 12 23:09:29 1997
626 @@ -1021,7 +1021,7 @@
627                 gnu_ld=yes
628                 # GNU libc version 2 does not supply these;
629                 # we want them from GCC.
630 -               extra_parts="crtbegin.o crtend.o"
631 +               extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
632                 ;;
633          i[3456]86-go32-msdos | i[3456]86-*-go32)
634                cpu_type=i386
635 -----------------------------------------------------------------------
636
637
638 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
639 [Q21]    ``On Linux I've got problems with the declarations in Linux
640            kernel headers.''
641
642 [A21] {UD,AJ} On Linux, the use of kernel headers is reduced to a very
643 minimum.  Besides giving Linus the possibility to change the headers
644 more freely it has another reason: user level programs now do not
645 always use the same types like the kernel does.
646
647 I.e., the libc abstracts the use of types.  E.g., the sigset_t type is
648 in the kernel 32 or 64 bits wide.  In glibc it is 1024 bits wide, in
649 preparation for future development.  The reasons are obvious: we don't
650 want to have a new major release when the Linux kernel gets these
651 functionality. Consult the headers for more information about the changes.
652
653 Therefore you shouldn't include Linux kernel header files directly if
654 glibc has defined a replacement. Otherwise you might get undefined
655 results because of type conflicts.
656
657
658 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
659 [Q22]   ``When I try to compile code which uses IPv6 header and
660           definitions on my Linux 2.x.y system I am in trouble.
661           Nothing seems to work.''
662
663 [A22] {UD} The problem is that the IPv6 development still has not reached
664 a point where it is stable.  There are still lots of incompatible changes
665 made and the libc headers have to follow.
666
667 Currently (as of 970401) according to Philip Blundell <pjb27@cam.ac.uk>
668 the required kernel version is 2.1.30.
669
670
671 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
672 [Q23]   ``When compiling GNU libc I get lots of errors saying functions
673           in glibc are duplicated in libgcc.''
674
675 [A23] {EY} This is *exactly* the same problem that I was having.  The
676 problem was due to the fact that the autoconfigure didn't correctly
677 detect that linker flag --no-whole-archive was supported in my linker.
678 In my case it was because I had run ./configure with bogus CFLAGS, and
679 the test failed.
680
681 One thing that is particularly annoying about this problem is that
682 once this is misdetected, running configure again won't fix it unless
683 you first delete config.cache.
684
685 {UD} Starting with glibc-2.0.3 there should be a better test to avoid
686 some problems of this kind.  The setting of CFLAGS is checked at the
687 very beginning and if it is not usable `configure' will bark.
688
689
690
691 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
692 [Q24]   ``I have set up /etc/nis.conf, and the Linux libc 5 with NYS
693           works great.  But the glibc NIS+ doesn't seem to work.''
694
695 [A24]   The glibc NIS+ implementation uses a /var/nis/NIS_COLD_START
696         file for storing information about the NIS+ server and their
697         public keys, because the nis.conf file do not contain all
698         necessary information.  You have to copy a NIS_COLD_START file
699         from a Solaris client (the NIS_COLD_START file is byte order
700         independend) or generate it new with nisinit from the nis-tools
701         (look at http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
702
703
704 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
705 \f
706 Answers were given by:
707 {UD} Ulrich Drepper, <drepper@cygnus.com>
708 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
709 {RM} Roland McGrath, <roland@gnu.ai.mit.edu>
710 {HJL} H.J. Lu, <hjl@gnu.ai.mit.edu>
711 {AJ} Andreas Jaeger, <aj@arthur.rhein-neckar.de>
712 {EY} Eric Youngdale, <eric@andante.jic.com>
713 \f
714 Local Variables:
715  mode:text
716 End: