Wed May 29 00:52:20 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / FAQ
blobf85b255bbcbb0fdaf8aa239353847e78072e6647
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 pacakge.  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 libc.so|grep " U "' on the produced library
35           I still find unresolved symbols?  Can this be ok?''
37 [Q8]    ``I expect GNU libc to be 100% source code compatible with
38           the old Linux based GNU libc.  Why isn't it like this?''
41 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
42 [Q1]    ``What systems does the GNU C Library run on?''
44 [A1] {UD} This is difficult to answer.  The file `README' lists the
45 architectures GNU libc is known to run *at some time*.  This does not
46 mean that it still can be compiled and run on them in the moment.
48 The systems glibc is known to work on in the moment and most probably
49 in the future are:
51         *-*-gnu                 GNU Hurd
52         i[3456]86-*-linux       Linux-2.0 on Intel
54 Other Linux platforms are also on the way to be supported but I need
55 some success reports first.
57 If you have a system not listed above (or in the `README' file) and
58 you are really interested in porting it, contact
60         <bug-glibc@prep.ai.mit.edu>
63 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
64 [Q2]    ``What compiler do I need to build GNU libc?''
66 [A2] {UD} It is (almost) impossible to compile GNU C Library using a
67 different compiler than GNU CC.  A lot of extensions of GNU CC are
68 used to increase the portability and speed.
70 But this does not mean you have to use GNU CC for using the GNU C
71 Library.  In fact you should be able to use the native C compiler
72 because the success only depends on the binutils: the linker and
73 archiver.
75 The GNU CC is found like all other GNU packages on
76         ftp://prep.ai.mit.edu/pub/gnu
77 or better one of the many mirrors.
79 You always should try to use the latest official release.  Older
80 versions might not have all the features GNU libc could use.
83 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
84 [Q3]    ``When starting make I get only errors messages.
85           What's wrong?''
87 [A3] {UD} You definitely need GNU make to translate GNU libc.  No
88 other make program has the needed functionality.
90 Versions before 3.74 have bugs which prevent correct execution so you
91 should upgrade to the latest version before starting the compilation.
94 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
95 [Q4]    ``After I changed configure.in I get `Autoconf version X.Y.
96           or higher is required for this script'.  What can I do?''
98 [A4] {UD} You have to get the specified autoconf version (or a later)
99 from your favourite mirror of prep.ai.mit.edu.
102 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
103 [Q5]    ``Do I need a special linker or archiver?''
105 [A5] {UD} If your native versions are not too buggy you can probably
106 work with them.  But GNU libc works best with GNU binutils.
108 On systems where the native linker does not support weak symbols you
109 will not get a really ISO C compliant C library.  Generally speaking
110 you should use the GNU binutils if they provide at least the same
111 functionality as your system's tools.
113 Always get the newest release of GNU binutils available.
114 Older releases are known to have bugs that affect building the GNU C library.
117 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
118 [Q6]    ``Do I need some more things to compile GNU C Library?''
120 [A6] {UD} Yes, there are some more :-).
122 * lots of diskspace (for i386-linux this means, e.g., ~70MB).
124   You should avoid compiling on a NFS mounted device.  This is very
125   slow.
127 * plenty of time (approx 1h for i386-linux on i586@133 or 2.5h or
128   i486@66).
130   If you are interested in some more measurements let me know.
133 * When compiling for Linux:
135   + the header files of the Linux kernel must be available in the
136     search path of the CPP as <linux/*.h> and <asm/*.h>.
139 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
140 [Q7]    ``When I run `nm libc.so|grep " U "' on the produced library
141           I still find unresolved symbols?  Can this be ok?''
143 [A7] {UD} Yes, this is ok.  There can be several kinds of unresolved
144 symbols:
146 * magic symbols automatically generated by the linker.  Names are
147   often like __start_* and __stop_*
149 * symbols resolved by using libgcc.a
150   (__udivdi3, __umoddi3, or similar)
152 * weak symbols, which need not be resolved at all
153   (currently fabs among others; this gets resolved if the program
154    is linked against libm, too.)
156 Generally, you should make sure you find a real program which produces
157 errors while linking before deciding there is a problem.
160 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
161 [Q8]    ``I expect GNU libc to be 100% source code compatible with
162           the old Linux based GNU libc.  Why isn't it like this?''
164 [A8] {DMT} Not every extension in Linux libc's history was well
165 thought-out.  In fact it had a lot of problems with standards compliance
166 and with cleanliness.  With the introduction of a new version number these
167 errors now can be corrected.  Here is a list of the known source code
168 incompatibilities:
170 * _GNU_SOURCE: glibc does not automatically define _GNU_SOURCE.  Thus,
171   if a program depends on GNU extensions or some other non-standard
172   functionality, it is necessary to compile it with C compiler option
173   -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at the beginning
174   of your source files, before any C library header files are included.
175   This difference normally manifests itself in the form of missing
176   prototypes and/or data type definitions.  Thus, if you get such errors,
177   the first thing you should do is try defining _GNU_SOURCE and see if
178   that makes the problem go away.
180   For more information consult the file `NOTES' part of the GNU C
181   library sources.
183 * reboot(): GNU libc sanitizes the interface of reboot() to be more
184   compatible with the interface used on other OSes.  In particular,
185   reboot() as implemented in glibc takes just one argument.  This argument
186   corresponds to the third argument of the Linux reboot system call.
187   That is, a call of the form reboot(a, b, c) needs to be changed into
188   reboot(c).
190 * errno: If a program uses variable "errno", then it _must_ include header
191   file <errno.h>.  The old libc often (erroneously) declared this variable
192   implicitly as a side-effect of including other libc header files.  glibc
193   is careful to avoid such namespace pollution, which, in turn, means that
194   you really need to include the header files that you depend on.  This
195   difference normally manifests itself in the form of the compiler
196   complaining about the references of the undeclared symbol "errno".
198 * Linux-specific syscalls: All Linux system calls now have appropriate
199   library wrappers and corresponding declarations in various header files.
200   This is because the syscall() macro that was traditionally used to
201   work around missing syscall wrappers are inherently non-portable and
202   error-prone.  The following tables lists all the new syscall stubs,
203   the header-file declaring their interface and the system call name.
205        syscall name:    wrapper name:   declaring header file:
206        -------------    -------------   ----------------------
207        bdflush          bdflush         ???
208        create_module    create_module   <sys/module.h>
209        delete_module    delete_module   <sys/module.h>
210        get_kernel_syms  get_kernel_syms <sys/module.h>
211        init_module      init_module     <sys/module.h>
212        syslog           ksyslog_ctl     ???
214 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
217 Answers were given by:
218 {UD} Ulrich Drepper, <drepper@cygnus.com>
219 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
221 Amended by:
222 {RM} Roland McGrath, <roland@gnu.ai.mit.edu>
224 Local Variables:
225  mode:text
226 End: