source: chapter05/glibc.xml@ aba5bfb

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk v5_1 v5_1_1 xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since aba5bfb was 5888299, checked in by Alex Gronenwoud <alex@…>, 20 years ago

Moving stuff from appendix A to chapter 6.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3161 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

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