1 | <sect1 id="ch05-glibc">
|
---|
2 | <title>Installing Glibc-&glibc-version;</title>
|
---|
3 | <?dbhtml filename="glibc.html" dir="chapter05"?>
|
---|
4 |
|
---|
5 | <screen>Estimated build time: &glibc-time-tools;
|
---|
6 | Estimated required disk space: &glibc-compsize-tools;</screen>
|
---|
7 |
|
---|
8 | &aa-glibc-shortdesc;
|
---|
9 | &aa-glibc-dep;
|
---|
10 |
|
---|
11 | <sect2><title> </title><para> </para></sect2>
|
---|
12 |
|
---|
13 | <sect2>
|
---|
14 | <title>Glibc installation</title>
|
---|
15 |
|
---|
16 | <para>Before starting to install Glibc, you must <userinput>cd</userinput>
|
---|
17 | into the <filename>glibc-&glibc-version;</filename> directory and unpack
|
---|
18 | Glibc-linuxthreads in that directory, not in the directory where you usually
|
---|
19 | unpack all the sources.</para>
|
---|
20 |
|
---|
21 | <note><para>We are going to run the test suite for Glibc in this chapter.
|
---|
22 | However, it's worth pointing out that running the Glibc test suite here
|
---|
23 | is considered not as important as running it in
|
---|
24 | <xref linkend="chapter06"/>.</para></note>
|
---|
25 |
|
---|
26 | <para>This package is known to behave badly when you have changed its
|
---|
27 | default optimization flags (including the -march and -mcpu options).
|
---|
28 | Therefore, if you have defined any environment variables that override
|
---|
29 | default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
|
---|
30 | them when building Glibc.</para>
|
---|
31 |
|
---|
32 | <para>Basically, compiling Glibc in any other way than the book suggests
|
---|
33 | is putting the stability of your system at risk.</para>
|
---|
34 |
|
---|
35 | <para>Though it is a harmless message, the install stage of Glibc will
|
---|
36 | complain about the absence of <filename>/tools/etc/ld.so.conf</filename>.
|
---|
37 | Fix this annoying little warning with:</para>
|
---|
38 |
|
---|
39 | <screen><userinput>mkdir /tools/etc
|
---|
40 | touch /tools/etc/ld.so.conf</userinput></screen>
|
---|
41 |
|
---|
42 | <para>Also, Glibc has a subtle problem when compiled with GCC &gcc-version;.
|
---|
43 | Apply the following patch to fix this:</para>
|
---|
44 |
|
---|
45 | <screen><userinput>patch -Np1 -i ../&glibc-sscanf-patch;</userinput></screen>
|
---|
46 |
|
---|
47 | <para>The Glibc documentation recommends building Glibc outside of the source
|
---|
48 | directory in a dedicated build directory:</para>
|
---|
49 |
|
---|
50 | <screen><userinput>mkdir ../glibc-build
|
---|
51 | cd ../glibc-build</userinput></screen>
|
---|
52 |
|
---|
53 | <para>Next, prepare Glibc for compilation:</para>
|
---|
54 |
|
---|
55 | <screen><userinput>../glibc-&glibc-version;/configure --prefix=/tools \
|
---|
56 | --disable-profile --enable-add-ons \
|
---|
57 | --with-headers=/tools/include \
|
---|
58 | --with-binutils=/tools/bin \
|
---|
59 | --without-gd</userinput></screen>
|
---|
60 |
|
---|
61 | <para>The meaning of the configure options:</para>
|
---|
62 |
|
---|
63 | <itemizedlist>
|
---|
64 | <listitem><para><userinput>--disable-profile</userinput>: This disables the
|
---|
65 | building of the libraries with profiling information. Omit this option if you
|
---|
66 | plan to do profiling.</para></listitem>
|
---|
67 |
|
---|
68 | <listitem><para><userinput>--enable-add-ons</userinput>: This enables any
|
---|
69 | add-ons that were installed with Glibc, in our case Linuxthreads.</para></listitem>
|
---|
70 |
|
---|
71 | <listitem><para><userinput>--with-binutils=/tools/bin</userinput> and
|
---|
72 | <userinput>--with-headers=/tools/include</userinput>: Strictly speaking
|
---|
73 | these switches are not required. But they ensure nothing can go wrong with
|
---|
74 | regard to what kernel headers and Binutils programs get used during the
|
---|
75 | Glibc build.</para></listitem>
|
---|
76 |
|
---|
77 | <listitem><para><userinput> --without-gd</userinput>: This switch ensures
|
---|
78 | that we don't build the <userinput>memusagestat</userinput> program, which
|
---|
79 | strangely enough insists on linking against the host's libraries (libgd,
|
---|
80 | libpng, libz, and so forth).</para></listitem>
|
---|
81 | </itemizedlist>
|
---|
82 |
|
---|
83 | <para>During this stage you might see the following warning:</para>
|
---|
84 |
|
---|
85 | <blockquote><screen>configure: WARNING:
|
---|
86 | *** These auxiliary programs are missing or incompatible versions: msgfmt
|
---|
87 | *** some features will be disabled.
|
---|
88 | *** Check the INSTALL file for required versions.</screen></blockquote>
|
---|
89 |
|
---|
90 | <para>The missing or incompatible <filename>msgfmt</filename> program is
|
---|
91 | generally harmless, but it's believed it can sometimes cause problems when
|
---|
92 | running the test suite.</para>
|
---|
93 |
|
---|
94 | <para>Compile the package:</para>
|
---|
95 |
|
---|
96 | <screen><userinput>make</userinput></screen>
|
---|
97 |
|
---|
98 | <para>Run the test suite:</para>
|
---|
99 |
|
---|
100 | <screen><userinput>make check</userinput></screen>
|
---|
101 |
|
---|
102 | <para>The Glibc test suite is highly dependent on certain functions of your host
|
---|
103 | system, in particular the kernel. Additionally, here in this chapter some tests
|
---|
104 | can be adversely affected by existing tools or environmental issues on the host
|
---|
105 | system. Of course, these won't be a problem when we run the Glibc test suite
|
---|
106 | inside the chroot environment of <xref linkend="chapter06"/>. In general, the
|
---|
107 | Glibc test suite is always expected to pass. However, as mentioned above, some
|
---|
108 | failures are unavoidable in certain circumstances. Here is a list of the most
|
---|
109 | common issues we are aware of:</para>
|
---|
110 |
|
---|
111 | <itemizedlist>
|
---|
112 | <listitem><para>The <emphasis>math</emphasis> tests sometimes fail when running
|
---|
113 | on systems where the CPU is not a relatively new genuine Intel or authentic AMD.
|
---|
114 | Certain optimization settings are also known to be a factor here.</para></listitem>
|
---|
115 |
|
---|
116 | <listitem><para>The <emphasis>gettext</emphasis> test sometimes fails due to
|
---|
117 | host system issues. The exact reasons are not yet clear.</para></listitem>
|
---|
118 |
|
---|
119 | <listitem><para>The <emphasis>atime</emphasis> test sometimes fails when the
|
---|
120 | LFS partition is mounted with the <emphasis>noatime</emphasis> option, or due
|
---|
121 | to other file system quirks.</para></listitem>
|
---|
122 |
|
---|
123 | <listitem><para>The <emphasis>shm</emphasis> test might fail when the host
|
---|
124 | system is running the devfs file system but doesn't have the tmpfs file system
|
---|
125 | mounted at <filename>/dev/shm</filename> due to lack of support for tmpfs in
|
---|
126 | the kernel.</para></listitem>
|
---|
127 |
|
---|
128 | <listitem><para>When running on older and slower hardware, some tests might
|
---|
129 | fail due to test timeouts being exceeded.</para></listitem>
|
---|
130 | </itemizedlist>
|
---|
131 |
|
---|
132 | <para>In summary, don't worry too much if you see Glibc test suite failures
|
---|
133 | here in this chapter. The Glibc in <xref linkend="chapter06"/> is the one we'll
|
---|
134 | ultimately end up using so that is the one we would really like to see pass.
|
---|
135 | But please keep in mind, even in <xref linkend="chapter06"/> some failures
|
---|
136 | could still occur -- the <emphasis>math</emphasis>
|
---|
137 | tests for example. When experiencing a failure, make a note of it, then
|
---|
138 | continue by reissuing the <userinput>make check</userinput>. The test suite
|
---|
139 | should pick up where it left off and continue on. You can circumvent this
|
---|
140 | stop-start sequence by issuing a <userinput>make -k check</userinput>. But if
|
---|
141 | you do that, be sure to log the output so that you can later peruse the log
|
---|
142 | file and examine the total number of failures.</para>
|
---|
143 |
|
---|
144 | <para>Now install the package:</para>
|
---|
145 |
|
---|
146 | <screen><userinput>make install</userinput></screen>
|
---|
147 |
|
---|
148 | <para>Different countries and cultures have varying conventions for how to
|
---|
149 | communicate. These conventions range from very simple ones, such as the format
|
---|
150 | for representing dates and times, to very complex ones, such as the language
|
---|
151 | spoken. The "internationalization" of GNU programs works by means of
|
---|
152 | <emphasis>locales</emphasis>. We'll install the Glibc locales now:</para>
|
---|
153 |
|
---|
154 | <screen><userinput>make localedata/install-locales</userinput></screen>
|
---|
155 |
|
---|
156 | <para>An alternative to running the previous command is to install only
|
---|
157 | those locales which you need or want. This can be achieved by using the
|
---|
158 | <userinput>localedef</userinput> command. Information on this can be
|
---|
159 | found in the <filename>INSTALL</filename> file in the
|
---|
160 | <filename>glibc-&glibc-version;</filename> source. However, there are a number
|
---|
161 | of locales that are essential for the tests of future packages to pass, in
|
---|
162 | particular, the <emphasis>libstdc++</emphasis> tests from GCC. The following
|
---|
163 | instructions, instead of the install-locales target above, will install
|
---|
164 | the minimum set of locales necessary for the tests to run successfully:</para>
|
---|
165 |
|
---|
166 | <screen><userinput>mkdir -p /tools/lib/locale
|
---|
167 | localedef -i de_DE -f ISO-8859-1 de_DE
|
---|
168 | localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
|
---|
169 | localedef -i en_HK -f ISO-8859-1 en_HK
|
---|
170 | localedef -i en_PH -f ISO-8859-1 en_PH
|
---|
171 | localedef -i en_US -f ISO-8859-1 en_US
|
---|
172 | localedef -i es_MX -f ISO-8859-1 es_MX
|
---|
173 | localedef -i fr_FR -f ISO-8859-1 fr_FR
|
---|
174 | localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
|
---|
175 | localedef -i it_IT -f ISO-8859-1 it_IT
|
---|
176 | localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen>
|
---|
177 |
|
---|
178 | </sect2>
|
---|
179 |
|
---|
180 | </sect1>
|
---|
181 |
|
---|