1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
6 <sect1 id="ch-tools-glibc" role="wrap">
7 <title>Glibc-&glibc-version;</title>
8 <?dbhtml filename="glibc.html"?>
10 <indexterm zone="ch-tools-glibc">
11 <primary sortas="a-Glibc">Glibc</primary>
12 <secondary>tools</secondary></indexterm>
14 <sect2 role="package"><title/>
15 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/glibc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
18 <segtitle>&buildtime;</segtitle>
19 <segtitle>&diskspace;</segtitle>
20 <seglistitem><seg>11.8 SBU</seg><seg>800 MB</seg></seglistitem>
23 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/glibc.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/>
27 <sect2 role="installation">
28 <title>Installation of Glibc</title>
30 <para>This package is known to have issues when its default
31 optimization flags (including the <parameter>-march</parameter> and
32 <parameter>-mcpu</parameter> options) are changed. If any environment
33 variables that override default optimizations have been defined, such
34 as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
35 unset them when building Glibc.</para>
37 <para>It should be noted that compiling Glibc in any way other than
38 the method suggested in this book puts the stability of the system at
41 <para>The Glibc documentation recommends building Glibc outside of the source
42 directory in a dedicated build directory:</para>
44 <screen><userinput>mkdir ../glibc-build
45 cd ../glibc-build</userinput></screen>
47 <para>Next, prepare Glibc for compilation:</para>
49 <screen><userinput>../glibc-&glibc-version;/configure --prefix=/tools \
50 --disable-profile --enable-add-ons \
51 --enable-kernel=2.6.0 --with-binutils=/tools/bin \
52 --without-gd --with-headers=/tools/include \
53 --without-selinux</userinput></screen>
55 <para>The meaning of the configure options:</para>
59 <term><parameter>--disable-profile</parameter></term>
60 <listitem><para>This builds the libraries without profiling
61 information. Omit this option if profiling on the temporary tools is
62 necessary.</para></listitem>
66 <term><parameter>--enable-add-ons</parameter></term>
67 <listitem><para>This tells Glibc to use the NPTL add-on as its threading
68 library.</para></listitem>
72 <term><parameter>--enable-kernel=2.6.0</parameter></term>
73 <listitem><para>This tells Glibc to compile the library with support
74 for 2.6.x Linux kernels.</para></listitem>
78 <term><parameter>--with-binutils=/tools/bin</parameter></term>
79 <listitem><para>While not required, this switch ensures that there are
80 no errors pertaining to which Binutils programs get used during the
81 Glibc build.</para></listitem>
85 <term><parameter>--without-gd</parameter></term>
86 <listitem><para>This prevents the build of the
87 <command>memusagestat</command> program, which insists on linking
88 against the host's libraries (libgd, libpng, libz,
89 etc.).</para></listitem>
93 <term><parameter>--with-headers=/tools/include</parameter></term>
94 <listitem><para>This tells Glibc to compile itself against the headers recently
95 installed to the tools directory, so that it knows exactly what features the
96 kernel has and can optimize itself accordingly.</para></listitem>
101 <term><parameter>--without-selinux</parameter></term>
102 <listitem><para>When building from hosts using SELinux functionality
103 (i.e. Fedora Core 3), glibc will try to integrate this functionality into
104 itself, but will fail, because we do not have this functionality in the LFS
105 tools environment. This option will disable this, allowing glibc to build
106 correctly, but will not otherwise affect the build.</para></listitem>
111 <para>During this stage the following warning might appear:</para>
113 <blockquote><screen><computeroutput>configure: WARNING:
114 *** These auxiliary programs are missing or
115 *** incompatible versions: msgfmt
116 *** some features will be disabled.
117 *** Check the INSTALL file for required versions.</computeroutput></screen></blockquote>
119 <para>The missing or incompatible <command>msgfmt</command> program is
120 generally harmless, but it can sometimes cause issues when running the
121 test suite. This <command>msgfmt</command> program is part of the
122 Gettext package which the host distribution should provide. If
123 <command>msgfmt</command> is present but deemed incompatible, upgrade
124 the host system's Gettext package or continue without it and see if
125 the test suite runs without problems regardless.</para>
127 <para>Compile the package:</para>
129 <screen><userinput>make</userinput></screen>
131 <para>Compilation is now complete. As mentioned earlier, running the
132 test suites for the temporary tools installed in this chapter is not
133 mandatory. To run the Glibc test suite (if desired), the following
134 command will do so:</para>
136 <screen><userinput>make check</userinput></screen>
138 <para>For a discussion of test failures that are of particular
139 importance, please see <xref linkend="ch-system-glibc" role="."/></para>
141 <para>In this chapter, some tests can be adversely effected by
142 existing tools or environmental issues on the host system. Glibc test
143 suite failures in this chapter are typically not worrisome. The Glibc
144 installed in <xref linkend="chapter-building-system"/> is the one that
145 will ultimately end up being used, so that is the one that needs to pass
146 most tests (even in <xref linkend="chapter-building-system"/>, some
147 failures could still occur, for example, with the math tests).</para>
149 <para>When experiencing a failure, make a note of it, then continue by
150 reissuing the <command>make check</command> command. The test suite should pick up where it left
151 off and continue. This stop-start sequence can be circumvented by
152 issuing a <command>make -k check</command> command. If using this option, be sure to log the
153 output so that the log file can be examined for failures later.</para>
155 <para>The install stage of Glibc will issue a harmless warning at the
156 end about the absence of <filename>/tools/etc/ld.so.conf</filename>.
157 Prevent this warning with:</para>
159 <screen><userinput>mkdir /tools/etc
160 touch /tools/etc/ld.so.conf</userinput></screen>
162 <para>Install the package:</para>
164 <screen><userinput>make install</userinput></screen>
166 <para>Different countries and cultures have varying conventions for
167 how to communicate. These conventions range from the format for
168 representing dates and times to more complex issues, such as the
169 language spoken. The <quote>internationalization</quote> of GNU
170 programs works by locale.</para>
172 <note><para>If the test suites are not being run in this chapter (as
173 per the recommendation), there is no need to install the locales now.
174 The appropriate locales will be installed in the next
175 chapter.</para></note>
177 <para>To install the Glibc locales anyway, use the following
180 <screen><userinput>make localedata/install-locales</userinput></screen>
182 <para>To save time, an alternative to running the
183 previous command (which generates and installs every locale Glibc is
184 aware of) is to install only those locales that are wanted and needed.
185 This can be achieved by using the <command>localedef</command>
186 command. Information on this command is located in the
187 <filename>INSTALL</filename> file in the Glibc source. However, there
188 are a number of locales that are essential in order for the tests of
189 future packages to pass, in particular, the
190 <emphasis>libstdc++</emphasis> tests from GCC. The following
191 instructions, instead of the <parameter>install-locales</parameter>
192 target used above, will install the minimum set of locales necessary
193 for the tests to run successfully:</para>
195 <screen><userinput>mkdir -p /tools/lib/locale
196 localedef -i de_DE -f ISO-8859-1 de_DE
197 localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
198 localedef -i en_HK -f ISO-8859-1 en_HK
199 localedef -i en_PH -f ISO-8859-1 en_PH
200 localedef -i en_US -f ISO-8859-1 en_US
201 localedef -i es_MX -f ISO-8859-1 es_MX
202 localedef -i fa_IR -f UTF-8 fa_IR
203 localedef -i fr_FR -f ISO-8859-1 fr_FR
204 localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
205 localedef -i it_IT -f ISO-8859-1 it_IT
206 localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen>
210 <sect2 role="content"><title/>
211 <para>Details on this package are located in <xref
212 linkend="contents-glibc" role="."/></para>