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 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
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.
132 * Some files depend on special tools. E.g., files ending in .gperf
133 need a `gperf' program. The GNU version (part of libg++) is known
134 to work while some vendor versions do not.
136 * When compiling for Linux:
138 + the header files of the Linux kernel must be available in the
139 search path of the CPP as <linux/*.h> and <asm/*.h>.
142 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
143 [Q7] ``When I run `nm libc.so|grep " U "' on the produced library
144 I still find unresolved symbols? Can this be ok?''
146 [A7] {UD} Yes, this is ok. There can be several kinds of unresolved
149 * magic symbols automatically generated by the linker. Names are
150 often like __start_* and __stop_*
152 * symbols resolved by using libgcc.a
153 (__udivdi3, __umoddi3, or similar)
155 * weak symbols, which need not be resolved at all
156 (currently fabs among others; this gets resolved if the program
157 is linked against libm, too.)
159 Generally, you should make sure you find a real program which produces
160 errors while linking before deciding there is a problem.
163 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
164 [Q8] ``I expect GNU libc to be 100% source code compatible with
165 the old Linux based GNU libc. Why isn't it like this?''
167 [A8] {DMT} Not every extension in Linux libc's history was well
168 thought-out. In fact it had a lot of problems with standards compliance
169 and with cleanliness. With the introduction of a new version number these
170 errors now can be corrected. Here is a list of the known source code
173 * _GNU_SOURCE: glibc does not automatically define _GNU_SOURCE. Thus,
174 if a program depends on GNU extensions or some other non-standard
175 functionality, it is necessary to compile it with C compiler option
176 -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at the beginning
177 of your source files, before any C library header files are included.
178 This difference normally manifests itself in the form of missing
179 prototypes and/or data type definitions. Thus, if you get such errors,
180 the first thing you should do is try defining _GNU_SOURCE and see if
181 that makes the problem go away.
183 For more information consult the file `NOTES' part of the GNU C
186 * reboot(): GNU libc sanitizes the interface of reboot() to be more
187 compatible with the interface used on other OSes. In particular,
188 reboot() as implemented in glibc takes just one argument. This argument
189 corresponds to the third argument of the Linux reboot system call.
190 That is, a call of the form reboot(a, b, c) needs to be changed into
193 * errno: If a program uses variable "errno", then it _must_ include header
194 file <errno.h>. The old libc often (erroneously) declared this variable
195 implicitly as a side-effect of including other libc header files. glibc
196 is careful to avoid such namespace pollution, which, in turn, means that
197 you really need to include the header files that you depend on. This
198 difference normally manifests itself in the form of the compiler
199 complaining about the references of the undeclared symbol "errno".
201 * Linux-specific syscalls: All Linux system calls now have appropriate
202 library wrappers and corresponding declarations in various header files.
203 This is because the syscall() macro that was traditionally used to
204 work around missing syscall wrappers are inherently non-portable and
205 error-prone. The following tables lists all the new syscall stubs,
206 the header-file declaring their interface and the system call name.
208 syscall name: wrapper name: declaring header file:
209 ------------- ------------- ----------------------
210 bdflush bdflush <sys/kdaemon.h>
211 create_module create_module <sys/module.h>
212 delete_module delete_module <sys/module.h>
213 get_kernel_syms get_kernel_syms <sys/module.h>
214 init_module init_module <sys/module.h>
215 syslog ksyslog_ctl <sys/klog.h>
217 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
220 Answers were given by:
221 {UD} Ulrich Drepper, <drepper@cygnus.com>
222 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
225 {RM} Roland McGrath, <roland@gnu.ai.mit.edu>