source: chapter05/glibc.xml@ bc12dcb

multilib-10.1
Last change on this file since bc12dcb was bc12dcb, checked in by Thomas Trepl <thomas@…>, 4 years ago

Merge upstream; Upgrade isl+firmware; add description to glibc

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11759 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 14.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-tools-glibc" role="wrap">
9 <?dbhtml filename="glibc.html"?>
10
11 <sect1info condition="script">
12 <productname>glibc</productname>
13 <productnumber>&glibc-version;</productnumber>
14 <address>&glibc-url;</address>
15 </sect1info>
16
17 <title>Glibc-&glibc-version;</title>
18
19 <indexterm zone="ch-tools-glibc">
20 <primary sortas="a-Glibc">Glibc</primary>
21 <secondary>tools</secondary>
22 </indexterm>
23
24 <sect2 role="package">
25 <title/>
26
27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
28 href="../chapter06/glibc.xml"
29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
30
31 <segmentedlist>
32 <segtitle>&buildtime;</segtitle>
33 <segtitle>&diskspace;</segtitle>
34
35 <seglistitem>
36 <seg>&glibc-ch5-sbu;</seg>
37 <seg>&glibc-ch5-du;</seg>
38 </seglistitem>
39 </segmentedlist>
40
41 </sect2>
42
43 <sect2 role="installation">
44 <title>Installation of Glibc</title>
45
46 <para>The Glibc documentation recommends building Glibc
47 in a dedicated build directory:</para>
48
49<screen><userinput remap="pre">mkdir -v build
50cd build</userinput></screen>
51
52 <para>Next, prepare Glibc for compilation:</para>
53
54<screen arch="default"><userinput remap="configure">../configure \
55 --prefix=/tools \
56 --host=$LFS_TGT \
57 --build=$(../scripts/config.guess) \
58 --enable-kernel=&min-kernel; \
59 --with-headers=/tools/include</userinput></screen>
60<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure \
61 --prefix=/tools \
62 --host=$LFS_TGT \
63 --build=$(../scripts/config.guess) \
64 --enable-kernel=&min-kernel; \
65 --enable-multi-arch \
66 --with-headers=/tools/include</userinput></screen>
67<!--
68 libc_cv_forced_unwind=yes \
69 libc_cv_c_cleanup=yes</userinput></screen> -->
70
71 <variablelist>
72 <title>The meaning of the configure options:</title>
73
74 <varlistentry>
75 <term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
76 <listitem>
77 <para>The combined effect of these switches is that Glibc's build system
78 configures itself to cross-compile, using the cross-linker and
79 cross-compiler in <filename class="directory">/tools</filename>.</para>
80 </listitem>
81 </varlistentry>
82
83 <varlistentry>
84 <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
85 <listitem>
86 <para>This tells Glibc to compile the library with support
87 for &min-kernel; and later Linux kernels. Workarounds for older
88 kernels are not enabled.</para>
89 </listitem>
90 </varlistentry>
91
92 <varlistentry arch="ml_32,ml_x32,ml_all">
93 <term><parameter>--enable-multi-arch</parameter></term>
94 <listitem>
95 <para>Enables glibc for multiarch environments.</para>
96 </listitem>
97 </varlistentry>
98
99 <varlistentry>
100 <term><parameter>--with-headers=/tools/include</parameter></term>
101 <listitem>
102 <para>This tells Glibc to compile itself against the headers recently
103 installed to the tools directory, so that it knows exactly what
104 features the kernel has and can optimize itself accordingly.</para>
105 </listitem>
106 </varlistentry>
107<!--
108 <varlistentry>
109 <term><parameter>libc_cv_forced_unwind=yes</parameter></term>
110 <listitem>
111 <para>The linker installed during
112 <xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as
113 such cannot be used until Glibc has been installed. This means that
114 the configure test for force-unwind support will fail, as it relies on
115 a working linker. The libc_cv_forced_unwind=yes variable is passed in
116 order to inform <command>configure</command> that force-unwind
117 support is available without it having to run the test.</para>
118 </listitem>
119 </varlistentry>
120 <varlistentry>
121 <term><parameter>libc_cv_c_cleanup=yes</parameter></term>
122 <listitem>
123 <para>Similarly, we pass libc_cv_c_cleanup=yes through to the
124 <command>configure</command> script so that the test is skipped and C
125 cleanup handling support is configured.</para>
126 </listitem>
127 </varlistentry>
128-->
129<!-- <varlistentry>
130 <term><parameter>libc_cv_ctors_header=yes</parameter></term>
131 <listitem>
132 <para>Similarly, we pass libc_cv_ctors_header=yes through to the
133 <command>configure</command> script so that the test is skipped and
134 gcc constructor support is configured.</para>
135 </listitem>
136 </varlistentry>-->
137
138 </variablelist>
139
140 <para>During this stage the following warning might appear:</para>
141
142 <blockquote>
143<screen><computeroutput>configure: WARNING:
144*** These auxiliary programs are missing or
145*** incompatible versions: msgfmt
146*** some features will be disabled.
147*** Check the INSTALL file for required versions.</computeroutput></screen>
148 </blockquote>
149
150 <para>The missing or incompatible <command>msgfmt</command> program is
151 generally harmless. This <command>msgfmt</command> program is part of the
152 Gettext package which the host distribution should provide.</para>
153
154 <note><para>There have been reports that this package may fail when
155 building as a "parallel make". If this occurs, rerun the make command
156 with a "-j1" option.</para></note>
157
158 <para>Compile the package:</para>
159
160<screen><userinput remap="make">make</userinput></screen>
161
162 <para>Install the package:</para>
163
164<screen><userinput remap="install">make install</userinput></screen>
165
166 <caution>
167 <para>At this point, it is imperative to stop and ensure that the basic
168 functions (compiling and linking) of the new toolchain are working as
169 expected. To perform a sanity check, run the following commands:</para>
170
171<screen><userinput>echo 'int main(){}' &gt; dummy.c
172$LFS_TGT-gcc dummy.c
173readelf -l a.out | grep ': /tools'</userinput></screen>
174
175 <para>If everything is working correctly, there should be no errors,
176 and the output of the last command will be of the form:</para>
177
178<screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
179
180 <para>Note that for 32-bit machines, the interpreter name will be
181 <filename>/tools/lib/ld-linux.so.2</filename>.</para>
182
183 <para>If the output is not shown as above or there was no output at all,
184 then something is wrong. Investigate and retrace the steps to find out
185 where the problem is and correct it. This issue must be resolved before
186 continuing on.</para>
187
188 <para>Once all is well, clean up the test files:</para>
189
190<screen><userinput>rm -v dummy.c a.out</userinput></screen>
191
192 </caution>
193
194 <note><para>Building Binutils in the section after next will serve as an
195 additional check that the toolchain has been built properly. If Binutils
196 fails to build, it is an indication that something has gone wrong with the
197 previous Binutils, GCC, or Glibc installations.</para></note>
198
199 </sect2>
200
201 <sect2 arch="ml_32,ml_all" role="installation">
202 <title>Installation of Glibc 32-bit</title>
203
204 <para>Clean the build directory for redoing glibc for 32-bit:</para>
205<screen><userinput remap="pre">mkdir ../build32
206cd ../build32</userinput></screen>
207
208 <para>Rebuild glibc for 32-bit:</para>
209<screen><userinput remap="configure">echo slibdir=/tools/lib32 &gt; configparms
210BUILD_CC="gcc -m32" \
211CC="${LFS_TGT}-gcc -m32" \
212CXX="${LFS_TGT}-g++ -m32" \
213AR="${LFS_TGT}-ar" \
214RANLIB="${LFS_TGT}-ranlib" \
215../configure --prefix=/tools \
216 --build=$(../scripts/config.guess) \
217 --host=${LFS_TGT32} \
218 --enable-kernel=&min-kernel; \
219 --with-headers=/tools/include \
220 --with-binutils=/tools/bin \
221 --enable-multi-arch \
222 --libdir=/tools/lib32 \
223 --libexecdir=/tools/lib32</userinput></screen>
224<!-- \
225 libc_cv_forced_unwind=yes \
226 libc_cv_c_cleanup=yes</userinput></screen> -->
227
228 <variablelist>
229 <title>The meaning of the extra configure options:</title>
230
231 <varlistentry>
232 <term><parameter>--enable-multi-arch</parameter></term>
233 <listitem>
234 <para>Enables glibc for multiarch environments.</para>
235 </listitem>
236 </varlistentry>
237
238 <varlistentry>
239 <term><parameter>--libdir=/tools/lib32, --libexecdir=/tools/lib32</parameter></term>
240 <listitem>
241 <para>Overrides location for installing 32-bit files.</para>
242 </listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><parameter>--with-binutils=/tools/bin</parameter></term>
247 <listitem>
248 <para>This tells Glibc to compile itself against the utilities
249 found within our "tools" heirachy, because otherwise...</para>
250 </listitem>
251 </varlistentry>
252
253 </variablelist>
254
255 <para>Now compile the 32-bit version of glibc:</para>
256<screen><userinput remap="make">make</userinput></screen>
257
258 <para>Install 32-bit version of glibc:</para>
259<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
260install -vdm755 /tools/lib32
261cp -Rv DESTDIR/tools/lib32/* /tools/lib32
262install -vm644 DESTDIR/tools/include/gnu/{lib-names,stubs}-32.h \
263 /tools/include/gnu/
264ln -svf /tools/lib32/ld-linux.so.2 /tools/lib/</userinput></screen>
265
266 </sect2>
267
268 <sect2 arch="ml_x32,ml_all" role="installation">
269 <title>Installation of Glibc x32-bit</title>
270
271 <para>Create a build directory for redoing glibc for x32-bit:</para>
272<screen><userinput remap="pre">mkdir ../build32x
273cd ../build32x</userinput></screen>
274
275 <para>Rebuild glibc for x32-bit:</para>
276<screen><userinput remap="configure">echo slibdir=/tools/libx32 &gt; configparms
277BUILD_CC="gcc -mx32" \
278CC="${LFS_TGT}-gcc -mx32" \
279CXX="${LFS_TGT}-g++ -mx32" \
280AR="${LFS_TGT}-ar" \
281RANLIB="${LFS_TGT}-ranlib" \
282../configure --prefix=/tools \
283 --build=$(../scripts/config.guess) \
284 --host=${LFS_TGTX32} \
285 --enable-kernel=&min-kernel; \
286 --with-headers=/tools/include \
287 --with-binutils=/tools/bin \
288 --enable-multi-arch \
289 --libdir=/tools/libx32 \
290 --libexecdir=/tools/libx32</userinput></screen>
291<!-- \
292 libc_cv_forced_unwind=yes \
293 libc_cv_c_cleanup=yes</userinput></screen> -->
294
295 <variablelist>
296 <title>The meaning of the extra configure options:</title>
297
298 <varlistentry>
299 <term><parameter>--enable-multi-arch</parameter></term>
300 <listitem>
301 <para>Enables glibc for multiarch environments.</para>
302 </listitem>
303 </varlistentry>
304
305 <varlistentry>
306 <term><parameter>--libdir=/tools/libx32, --libexecdir=/tools/libx32</parameter></term>
307 <listitem>
308 <para>Overrides location for installing x32-bit files.</para>
309 </listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><parameter>--with-binutils=/tools/bin</parameter></term>
314 <listitem>
315 <para>This tells Glibc to compile itself against the utilities
316 found within our "tools" heirachy, because otherwise...</para>
317 </listitem>
318 </varlistentry>
319
320 </variablelist>
321
322 <para>Now compile the x32-bit version of glibc:</para>
323<screen><userinput remap="make">make</userinput></screen>
324
325 <para>Install x32-bit version of glibc:</para>
326<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
327install -vdm755 /tools/libx32
328cp -Rv DESTDIR/tools/libx32/* /tools/libx32
329install -vm644 DESTDIR/tools/include/gnu/lib-names-x32.h \
330 /tools/include/gnu/
331[ -e DESTDIR/tools/include/gnu/stubs-x32.h ] \
332 &amp;&amp; install -vm644 DESTDIR/tools/include/gnu/stubs-x32.h /tools/include/gnu/ \
333 || ln -v /tools/include/gnu/stubs-64.h /tools/include/gnu/stubs-x32.h
334ln -svf /tools/libx32/ld-linux-x32.so.2 /tools/lib/</userinput></screen>
335<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
336just a "brute force" workaraound - by copying the stubs-64.h file. -->
337
338 <caution>
339 <para>At this point, it is imperative to stop and ensure that the basic
340 functions (compiling and linking) of the new toolchain are working as
341 expected. To perform a sanity check, run the following commands:</para>
342
343<screen><userinput>echo 'int main(){}' &gt; dummy.c
344$LFS_TGT-gcc -m32 dummy.c
345readelf -l a.out | grep ': /tools'</userinput></screen>
346
347 <para>If everything is working correctly, there should be no errors,
348 and the output of the last command will be of the form:</para>
349
350<screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
351
352 <para>Redo test for x32-ABI:</para>
353
354<screen><userinput>echo 'int main(){}' &gt; dummy.c
355$LFS_TGT-gcc -mx32 dummy.c
356readelf -l a.out | grep ': /tools'</userinput></screen>
357
358 <para>Output should be like:</para>
359
360<screen><computeroutput>[Requesting program interpreter: /tools/libx32/ld-linux-x32.so.2]</computeroutput></screen>
361
362 <para>If the output is not shown as above or there was no output at all,
363 then something is wrong. Investigate and retrace the steps to find out
364 where the problem is and correct it. This issue must be resolved before
365 continuing on.</para>
366
367 <para>Once all is well, clean up the test files:</para>
368
369<screen><userinput>rm -v dummy.c a.out</userinput></screen>
370
371 </caution>
372 </sect2>
373
374 <sect2 role="content">
375 <title/>
376
377 <para>Details on this package are located in
378 <xref linkend="contents-glibc" role="."/></para>
379
380 </sect2>
381
382</sect1>
Note: See TracBrowser for help on using the repository browser.