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,
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 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
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
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.
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 work with
106 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
127 * plenty of time (approx 1h for i386-linux on i586@133 or 2.5h or
130 If you are interested in some more measurements let me know.
133 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
134 [Q7] ``When I run `nm libc.so|grep " U "' on the produced library
135 I still find unresolved symbols? Can this be ok?''
137 [A7] {UD} Yes, this is ok. There can be several kinds of unresolved
140 * magic symbols automatically generated by the linker. Names are
141 often like __start_* and __stop_*-
143 * symbols resolved by using libgcc.a
144 (__udivdi3, __umoddi3, or similar)
146 * weak symbols, which need not be resolved at all
147 (currently fabs among others; this gets resolved if the program
148 is linked against libm, too.)
150 Generally, you should make sure you find a real program which produces
151 errors while linking before deciding there is a problem.
154 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
155 [Q8] ``I expect GNU libc to be 100% source code compatible with
156 the old Linux based GNU libc. Why isn't it like this?''
158 [A8] {DMT} Not every extension in Linux libc's history was well
159 thought-out. In fact it had a lot of problems with standards compliance
160 and with cleanliness. With the introduction of a new version number these
161 errors now can be corrected. Here is a list of the known source code
164 * _GNU_SOURCE: glibc does not automatically define _GNU_SOURCE. Thus, if a
165 program depends on GNU extensions, it is necessary to compile it with C
166 compiler option -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at
167 the beginning of your source files, before any C library header files are
168 included. This difference normally mainfests itself in the form of
169 missing prototypes and/or data type definitions. Thus, if you get such
170 errors, the first thing you should do is try defining _GNU_SOURCE and see
171 if that makes the problem go away.
173 * reboot(): GNU libc sanitizes the interface of reboot() to be more
174 compatible with the interface used on other OSes. In particular,
175 reboot() as implemented in glibc takes just one argument. This argument
176 corresponds to the third argument of the Linux reboot system call.
177 That is, a call of the form reboot(a, b, c) needs to be changed into
180 * errno: If a program uses variable "errno", then it _must_ include header
181 file <errno.h>. The old libc often (erroneously) declared this variable
182 implicitly as a side-effect of including other libc header files. glibc
183 is careful to avoid such namespace pollution, which, in turn, means that
184 you really need to include the header files that you depend on. This
185 difference normally manifests itself in the form of the compiler
186 complaining about the references of the undeclared symbol "errno".
188 * Linux-specific syscalls: All Linux system calls now have appropriate
189 library wrappers and corresponding declarations in various header files.
190 This is because the syscall() macro that was traditionally used to
191 work around missing syscall wrappers are inherently non-portable and
192 error-prone. The following tables lists all the new syscall stubs,
193 the header-file declaring their interface and the system call name.
195 syscall name: wrapper name: declaring header file:
196 ------------- ------------- ----------------------
198 create_module create_module <sys/module.h>
199 delete_module delete_module <sys/module.h>
200 get_kernel_syms get_kernel_syms <sys/module.h>
201 init_module init_module <sys/module.h>
202 syslog ksyslog_ctl ???
204 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
207 Answers were given by:
208 {UD} Ulrich Drepper, <drepper@cygnus.com>
209 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
212 {RM} Roland McGrath <roland@gnu.ai.mit.edu>