source: chapter08/glibc.xml@ 25b402c

ml-11.0 multilib
Last change on this file since 25b402c was 6dfcfecc, checked in by Xℹ Ruoyao <xry111@…>, 3 years ago

Update to new lfs structure

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

  • Property mode set to 100644
File size: 39.6 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
[b06ca36]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[673b0d8]4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
[6a82dd9]7
[81fd230]8<sect1 id="ch-system-glibc" role="wrap">
[6a82dd9]9 <?dbhtml filename="glibc.html"?>
10
[e747759]11 <sect1info condition="script">
12 <productname>glibc</productname>
13 <productnumber>&glibc-version;</productnumber>
14 <address>&glibc-url;</address>
15 </sect1info>
16
[6a82dd9]17 <title>Glibc-&glibc-version;</title>
18
19 <indexterm zone="ch-system-glibc">
20 <primary sortas="a-Glibc">Glibc</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The Glibc package contains the main C library. This library provides
27 the basic routines for allocating memory, searching directories, opening and
28 closing files, reading and writing files, string handling, pattern matching,
29 arithmetic, and so on.</para>
30
31 <segmentedlist>
32 <segtitle>&buildtime;</segtitle>
33 <segtitle>&diskspace;</segtitle>
34
35 <seglistitem>
[6dfcfecc]36 <seg>&glibc-fin-sbu;</seg>
37 <seg>&glibc-fin-du;</seg>
[6a82dd9]38 </seglistitem>
39 </segmentedlist>
40
41 </sect2>
42
43 <sect2 role="installation">
44 <title>Installation of Glibc</title>
[12836f5]45
[725ef3b]46 <para>Some of the Glibc programs use the non-FHS compliant
[4028929]47 <filename class="directory">/var/db</filename> directory to store
48 their runtime data. Apply the following patch to make such programs
49 store their runtime data in the FHS-compliant locations:</para>
50
51<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
[ffbeb5f]52
[f1dd547]53 <para>The Glibc documentation recommends building Glibc
54 in a dedicated build directory:</para>
[73aedd1d]55
[f1dd547]56<screen><userinput remap="pre">mkdir -v build
57cd build</userinput></screen>
[c906b7e]58
[6a82dd9]59 <para>Prepare Glibc for compilation:</para>
[73aedd1d]60
[6dfcfecc]61<screen arch="default"><userinput remap="configure">../configure --prefix=/usr \
62 --disable-werror \
63 --enable-kernel=&min-kernel; \
64 --enable-stack-protector=strong \
65 --with-headers=/usr/include \
66 libc_cv_slibdir=/lib</userinput></screen>
67<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr \
68 --disable-werror \
69 --enable-kernel=&min-kernel; \
70 --enable-stack-protector=strong \
71 --with-headers=/usr/include \
72 --enable-multi-arch \
[797ada6]73 libc_cv_slibdir=/lib</userinput></screen>
[73aedd1d]74
[6dfcfecc]75 <variablelist>
76 <title>The meaning of the configure options:</title>
[0967c90]77
78 <varlistentry>
[6dfcfecc]79 <term><parameter>--disable-werror</parameter></term>
[0967c90]80 <listitem>
[6dfcfecc]81 <para>This option disables the -Werror option passed to
82 GCC. This is necessary for running the test suite.</para>
[0967c90]83 </listitem>
84 </varlistentry>
[5897639]85
86 <varlistentry>
[6dfcfecc]87 <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
[5897639]88 <listitem>
[6dfcfecc]89 <para>This option tells the build system that this glibc may
90 be used with kernels as old as &min-kernel;. This means generating
91 workarounds in case a system call introduced in a later version
92 cannot be used.</para>
[5897639]93 </listitem>
94 </varlistentry>
95
96 <varlistentry>
97 <term><parameter>--enable-stack-protector=strong</parameter></term>
98 <listitem>
[0d84af1]99 <para>This option increases system security by adding
100 extra code to check for buffer overflows, such as stack
101 smashing attacks.</para>
[5897639]102 </listitem>
103 </varlistentry>
[6dfcfecc]104<!-- do we need this one? -->
[6702623]105 <varlistentry>
106 <term><parameter>--with-headers=/usr/include</parameter></term>
107 <listitem>
108 <para>This option tells the build system where to find the
[6dfcfecc]109 kernel API headers.</para>
[6702623]110 </listitem>
111 </varlistentry>
112
[5897639]113 <varlistentry>
114 <term><parameter>libc_cv_slibdir=/lib</parameter></term>
115 <listitem>
116 <para>This variable sets the correct library for all
117 systems. We do not want lib64 to be used.</para>
118 </listitem>
119 </varlistentry>
120
121 </variablelist>
122
[6a82dd9]123 <para>Compile the package:</para>
[73aedd1d]124
[0445a3d]125<screen><userinput remap="make">make</userinput></screen>
[73aedd1d]126
[6a82dd9]127 <important>
128 <para>In this section, the test suite for Glibc is considered critical.
129 Do not skip it under any circumstance.</para>
130 </important>
[81fd230]131
[0d84af1]132 <para>Generally a few tests do not pass. The test failures listed below
133 are usually safe to ignore.</para>
[d9c836b]134
[082bbce]135<!-- Use remap="make" here to work around a jhalfs issue. -->
136<screen><userinput remap="make">case $(uname -m) in
[1b3fac7]137 i?86) ln -sfnv $PWD/elf/ld-linux.so.2 /lib ;;
138 x86_64) ln -sfnv $PWD/elf/ld-linux-x86-64.so.2 /lib ;;
[082bbce]139esac</userinput></screen>
[2e02c35]140
[70b235f4]141 <note><para>The symbolic link above is needed to run the tests at this
[d7f58cc]142 stage of building in the chroot environment. It will be overwritten
[70b235f4]143 in the install phase below.</para></note>
144
[082bbce]145<screen><userinput remap="test">make check</userinput></screen>
146
[5897639]147 <para>You may see some test failures. The Glibc test suite is
[3b66f6a]148 somewhat dependent on the host system. This is a list of the most common
[5897639]149 issues seen for some versions of LFS:</para>
[6a82dd9]150
151 <itemizedlist>
[5d1f0157]152
[751a13d]153 <listitem>
154 <para><emphasis>misc/tst-ttyname</emphasis>
155 is known to fail in the LFS chroot environment.</para>
156 </listitem>
[6dfcfecc]157<!--
[efca30a]158 <listitem>
159 <para><emphasis>inet/tst-idna_name_classify</emphasis>
160 is known to fail in the LFS chroot environment.</para>
161 </listitem>
[f783741]162
[0238d49]163 <listitem>
[5897639]164 <para><emphasis>posix/tst-getaddrinfo4</emphasis> and
165 <emphasis>posix/tst-getaddrinfo5</emphasis>
166 may fail on some architectures.</para>
[0238d49]167 </listitem>
[6dfcfecc]168-->
[de6905d]169 <listitem>
170 <para>The <emphasis>nss/tst-nss-files-hosts-multi</emphasis>
171 test may fail for reasons that have not been determined.</para>
172 </listitem>
173
[d9c836b]174 <listitem>
[1b3fac7]175 <para>The <emphasis>rt/tst-cputimer{1,2,3}</emphasis> tests depend on
176 the host system kernel. Kernels 4.14.91&ndash;4.14.96,
177 4.19.13&ndash;4.19.18, and 4.20.0&ndash;4.20.5 are known to
[235556a]178 cause these tests to fail.
[1b3fac7]179 </para>
[6a82dd9]180 </listitem>
[a271796]181
[6a82dd9]182 <listitem>
[a0ec869]183 <para>The math tests sometimes fail when running on
[9218b05]184 systems where the CPU is not a relatively new Intel or
185 AMD processor.</para>
[6a82dd9]186 </listitem>
[9218b05]187
[6a82dd9]188 </itemizedlist>
189
190 <para>Though it is a harmless message, the install stage of Glibc will
191 complain about the absence of <filename>/etc/ld.so.conf</filename>.
192 Prevent this warning with:</para>
[1caa48e]193
[0445a3d]194<screen><userinput remap="install">touch /etc/ld.so.conf</userinput></screen>
[1caa48e]195
[1a2bc54]196 <para>Fix the generated Makefile to skip an unneeded sanity check
[ffbeb5f]197 that fails in the LFS partial environment:
198 </para>
199
200<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile</userinput></screen>
201
[6a82dd9]202 <para>Install the package:</para>
[73aedd1d]203
[0445a3d]204<screen><userinput remap="install">make install</userinput></screen>
[73aedd1d]205
[4028929]206 <para>Install the configuration file and runtime directory for
207 <command>nscd</command>:</para>
208
[f1dd547]209<screen><userinput remap="install">cp -v ../nscd/nscd.conf /etc/nscd.conf
[4028929]210mkdir -pv /var/cache/nscd</userinput></screen>
211
[1118b17]212 <para revision="systemd">Install the systemd support files for
213 <command>nscd</command>:</para>
214
215 <screen revision="systemd"><userinput remap="install">install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf
216install -v -Dm644 ../nscd/nscd.service /lib/systemd/system/nscd.service</userinput></screen>
217
[d730742]218 <para>Next, install the locales that can make the system respond in a
219 different language. None of the locales are required, but if some of them
220 are missing, the test suites of future packages would skip important
221 testcases.</para>
[6a82dd9]222
223 <para>Individual locales can be installed using the
224 <command>localedef</command> program. E.g., the first
225 <command>localedef</command> command below combines the
[fffccab]226 <filename>/usr/share/i18n/locales/cs_CZ</filename>
[6a82dd9]227 charset-independent locale definition with the
[fffccab]228 <filename>/usr/share/i18n/charmaps/UTF-8.gz</filename>
[6a82dd9]229 charmap definition and appends the result to the
230 <filename>/usr/lib/locale/locale-archive</filename> file.
231 The following instructions will install the minimum set of
232 locales necessary for the optimal coverage of tests:</para>
[3f0c882]233
[0445a3d]234<screen role="nodump"><userinput remap="locale-test">mkdir -pv /usr/lib/locale
[75828c3]235localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
[1e77f0c]236localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
[73aedd1d]237localedef -i de_DE -f ISO-8859-1 de_DE
238localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
[1e77f0c]239localedef -i de_DE -f UTF-8 de_DE.UTF-8
[75828c3]240localedef -i el_GR -f ISO-8859-7 el_GR
[e9aabce]241localedef -i en_GB -f UTF-8 en_GB.UTF-8
[73aedd1d]242localedef -i en_HK -f ISO-8859-1 en_HK
243localedef -i en_PH -f ISO-8859-1 en_PH
244localedef -i en_US -f ISO-8859-1 en_US
[3a35b11]245localedef -i en_US -f UTF-8 en_US.UTF-8
[73aedd1d]246localedef -i es_MX -f ISO-8859-1 es_MX
[673b0d8]247localedef -i fa_IR -f UTF-8 fa_IR
[73aedd1d]248localedef -i fr_FR -f ISO-8859-1 fr_FR
249localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
[d93d1c90]250localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
[73aedd1d]251localedef -i it_IT -f ISO-8859-1 it_IT
[5b36d32]252localedef -i it_IT -f UTF-8 it_IT.UTF-8
[1e77f0c]253localedef -i ja_JP -f EUC-JP ja_JP
[75828c3]254localedef -i ja_JP -f SHIFT_JIS ja_JP.SIJS 2> /dev/null || true
[74f027f]255localedef -i ja_JP -f UTF-8 ja_JP.UTF-8
[5b36d32]256localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
257localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
[fffccab]258localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
[75828c3]259localedef -i zh_CN -f GB18030 zh_CN.GB18030
260localedef -i zh_HK -f BIG5-HKSCS zh_HK.BIG5-HKSCS</userinput></screen>
[73aedd1d]261
[6a82dd9]262 <para>In addition, install the locale for your own country, language and
263 character set.</para>
[fa21b3d]264
[6a82dd9]265 <para>Alternatively, install all locales listed in the
266 <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
267 (it includes every locale listed above and many more) at once with the
268 following time-consuming command:</para>
[fa21b3d]269
[0445a3d]270<screen><userinput remap="locale-full">make localedata/install-locales</userinput></screen>
[fa21b3d]271
[6a82dd9]272 <para>Then use the <command>localedef</command> command to create and
273 install locales not listed in the
274 <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
[5a25e0a]275 in the unlikely case you need them.</para>
[6a82dd9]276
[3b03219]277 <note><para>Glibc now uses libidn2 when resolving internationalized
278 domain names. This is a run time dependency. If this capability
[235556a]279 is needed, the instructions for installing libidn2 are in the
[3b03219]280 <ulink url="&blfs-book;general/libidn2.html">BLFS libidn2 page</ulink>.
281 </para></note>
282
[6a82dd9]283 </sect2>
[94aa6621]284
[6a82dd9]285 <sect2 id="conf-glibc" role="configuration">
286 <title>Configuring Glibc</title>
[5888299]287
[6a82dd9]288 <indexterm zone="conf-glibc">
289 <primary sortas="e-/etc/nsswitch.conf">/etc/nsswitch.conf</primary>
290 </indexterm>
[81fd230]291
[6a82dd9]292 <indexterm zone="conf-glibc">
293 <primary sortas="e-/etc/localtime">/etc/localtime</primary>
294 </indexterm>
[342b176]295
[a72ca33]296 <sect3>
297 <title>Adding nsswitch.conf</title>
298
[6a82dd9]299 <para>The <filename>/etc/nsswitch.conf</filename> file needs to be created
[a72ca33]300 because the Glibc defaults do not work well in a networked environment.
301 </para>
[6a82dd9]302
303 <para>Create a new file <filename>/etc/nsswitch.conf</filename> by running the
304 following:</para>
[342b176]305
[bb55064]306<screen><userinput>cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"
[d72e04a]307<literal># Begin /etc/nsswitch.conf
[342b176]308
309passwd: files
310group: files
311shadow: files
312
313hosts: files dns
314networks: files
315
[4a80bec]316protocols: files
317services: files
318ethers: files
319rpc: files
[342b176]320
[d72e04a]321# End /etc/nsswitch.conf</literal>
[bb55064]322EOF</userinput></screen>
[342b176]323
[a72ca33]324 </sect3>
325
326 <sect3>
327 <title>Adding time zone data</title>
328
[edbeeb5]329 <para>Install and set up the time zone data with the following:</para>
[f1dd547]330<screen><userinput>tar -xf ../../tzdata&tzdata-version;.tar.gz
[f1c177f]331
[ea31e92]332ZONEINFO=/usr/share/zoneinfo
[2ca8941]333mkdir -pv $ZONEINFO/{posix,right}
[ea31e92]334
335for tz in etcetera southamerica northamerica europe africa antarctica \
[fabfe841]336 asia australasia backward pacificnew systemv; do
[082bbce]337 zic -L /dev/null -d $ZONEINFO ${tz}
338 zic -L /dev/null -d $ZONEINFO/posix ${tz}
339 zic -L leapseconds -d $ZONEINFO/right ${tz}
[287a36b4]340done
[f0f7ea0]341
[f1d755b]342cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
[ea31e92]343zic -d $ZONEINFO -p America/New_York
344unset ZONEINFO</userinput></screen>
[f1c177f]345
[7a6bcf9]346 <variablelist>
347 <title>The meaning of the zic commands:</title>
348
349 <varlistentry>
350 <term><parameter>zic -L /dev/null ...</parameter></term>
351 <listitem>
[6dfcfecc]352 <para>This creates posix time zones without any leap seconds. It is
[7a6bcf9]353 conventional to put these in both
354 <filename class="directory">zoneinfo</filename> and
355 <filename class="directory">zoneinfo/posix</filename>. It is
[edbeeb5]356 necessary to put the POSIX time zones in
[7a6bcf9]357 <filename class="directory">zoneinfo</filename>, otherwise various
358 test-suites will report errors. On an embedded system, where space is
[edbeeb5]359 tight and you do not intend to ever update the time zones, you could save
[6dfcfecc]360 1.9 MB by not using the <filename class="directory">posix</filename>
[7bb9fda]361 directory, but some applications or test-suites might produce some
362 failures.</para>
[7a6bcf9]363 </listitem>
364 </varlistentry>
365 <varlistentry>
366 <term><parameter>zic -L leapseconds ...</parameter></term>
367 <listitem>
[edbeeb5]368 <para>This creates right time zones, including leap seconds. On an
[7a6bcf9]369 embedded system, where space is tight and you do not intend to
[edbeeb5]370 ever update the time zones, or care about the correct time, you could
[7a6bcf9]371 save 1.9MB by omitting the <filename class="directory">right</filename>
372 directory.</para>
373 </listitem>
374 </varlistentry>
375 <varlistentry>
376 <term><parameter>zic ... -p ...</parameter></term>
377 <listitem>
[d7f2eb0]378 <para>This creates the <filename>posixrules</filename> file. We use
[cb02946]379 New York because POSIX requires the daylight savings time rules
[e7134f1]380 to be in accordance with US rules.</para>
[7a6bcf9]381 </listitem>
382 </varlistentry>
383 </variablelist>
384
385
386 <para>One way to determine the local time zone is to run the following
[e1060de]387 script:</para>
[342b176]388
[be4be92]389<screen role="nodump"><userinput>tzselect</userinput></screen>
[342b176]390
[6a82dd9]391 <para>After answering a few questions about the location, the script will
[e1060de]392 output the name of the time zone (e.g.,
393 <emphasis>America/Edmonton</emphasis>). There are also some other possible
[edbeeb5]394 time zones listed in <filename
[e1060de]395 class='directory'>/usr/share/zoneinfo</filename> such as
396 <emphasis>Canada/Eastern</emphasis> or <emphasis>EST5EDT</emphasis> that
397 are not identified by the script but can be used.</para>
398
399 <para>Then create the <filename>/etc/localtime</filename> file by
400 running:</para>
[342b176]401
[1daca67]402<screen><userinput>ln -sfv /usr/share/zoneinfo/<replaceable>&lt;xxx&gt;</replaceable> /etc/localtime</userinput></screen>
[342b176]403
[e1060de]404 <para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the name of the
405 time zone selected (e.g., Canada/Eastern).</para>
[6a82dd9]406
[a72ca33]407 </sect3>
[6a82dd9]408
[a72ca33]409 <sect3 id="conf-ld" role="configuration">
[6a82dd9]410 <title>Configuring the Dynamic Loader</title>
411
412 <indexterm zone="conf-ld">
413 <primary sortas="e-/etc/ld.so.conf">/etc/ld.so.conf</primary>
414 </indexterm>
415
416 <para>By default, the dynamic loader (<filename
417 class="libraryfile">/lib/ld-linux.so.2</filename>) searches through
418 <filename class="directory">/lib</filename> and <filename
419 class="directory">/usr/lib</filename> for dynamic libraries that are
420 needed by programs as they are run. However, if there are libraries in
421 directories other than <filename class="directory">/lib</filename> and
422 <filename class="directory">/usr/lib</filename>, these need to be added
423 to the <filename>/etc/ld.so.conf</filename> file in order for the
424 dynamic loader to find them. Two directories that are commonly known
425 to contain additional libraries are <filename
426 class="directory">/usr/local/lib</filename> and <filename
427 class="directory">/opt/lib</filename>, so add those directories to the
428 dynamic loader's search path.</para>
429
430 <para>Create a new file <filename>/etc/ld.so.conf</filename> by running the
431 following:</para>
[342b176]432
[bb55064]433<screen><userinput>cat &gt; /etc/ld.so.conf &lt;&lt; "EOF"
[d72e04a]434<literal># Begin /etc/ld.so.conf
[342b176]435/usr/local/lib
436/opt/lib
[50f648b]437</literal>
[bb55064]438EOF</userinput></screen>
[342b176]439
[6dfcfecc]440 <para>If desired, the dynamic loader can also search a directory and
[2ca8941]441 include the contents of files found there. Generally the files in
[50f648b]442 this include directory are one line specifying the desired library path.
443 To add this capability run the following commands:</para>
444
[6dfcfecc]445<screen role="nodump"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; "EOF"
[50f648b]446<literal># Add an include directory
447include /etc/ld.so.conf.d/*.conf
448</literal>
449EOF
[3d086301]450mkdir -pv /etc/ld.so.conf.d</userinput></screen>
[50f648b]451
[a72ca33]452 </sect3>
[6a82dd9]453 </sect2>
454
[6dfcfecc]455 <!-- - - - - - - - - - -->
456 <!-- Multilib - 32bit -->
457 <!-- - - - - - - - - - -->
458 <sect2 arch="ml_32,ml_all">
459 <title>Building Glibc - 32bit</title>
460
461 <para>Now recompile for m32. The extracted source can be
462 reused but needs to cleaned before installing the m32
463 version of Glibc.</para>
464
465 <para>Clear the build directory and remove artefacts from
466 previous build:</para>
467
468<screen><userinput remap="pre">rm -rf ./*
469find .. -name "*.a" -delete</userinput></screen>
470
471 <para>Configure Glibc for m32 with the following commands:</para>
472
473<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \
474../configure \
475 --prefix=/usr \
476 --host=i686-pc-linux-gnu \
477 --build=$(../scripts/config.guess) \
478 --enable-kernel=&min-kernel; \
479 --with-headers=/usr/include \
480 --enable-multi-arch \
481 --libdir=&usr-lib-m32; \
482 --libexecdir=&usr-lib-m32; \
483 libc_cv_slibdir=&lib-m32;</userinput></screen>
484
485 <para>Compile the package:</para>
486
487<screen><userinput remap="make">make</userinput></screen>
488
489 <para>Install the package:</para>
490
491<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
492cp -a DESTDIR&lib-m32;/* &lib-m32;/
493cp -a DESTDIR&usr-lib-m32;/* &usr-lib-m32;/
494install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
495 /usr/include/gnu/
496ln -svf ..&lib-m32;/ld-linux.so.2 /lib/ld-linux.so.2</userinput></screen>
497
498 <para>Add the library name to the dynamic loader config:</para>
499
500<screen role="install"><userinput>echo "&usr-lib-m32;" &gt;&gt; /etc/ld.so.conf</userinput></screen>
501
502 <caution>
503 <para>At this point, it is imperative to stop and ensure that the basic
504 functions (compiling and linking) of the new toolchain are working as
505 expected. To perform a sanity check, run the following commands:</para>
506
507<screen><userinput>echo 'int main(){}' &gt; dummy.c
508gcc -m32 dummy.c
509readelf -l a.out | grep '/ld-linux'</userinput></screen>
510
511 <para>If everything is working correctly, there should be no errors,
512 and the output of the last command will be of the form:</para>
513
514<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
515
516 <para>If the output is not shown as above or there was no output at all,
517 then something is wrong. Investigate and retrace the steps to find out
518 where the problem is and correct it. This issue must be resolved before
519 continuing on.</para>
520
521 <para>Once all is well, clean up the test files:</para>
522
523<screen><userinput>rm -v dummy.c a.out</userinput></screen>
524
525 </caution>
526
527 </sect2><!-- m32 -->
528
529 <!-- - - - - - - - - - -->
530 <!-- Multilib - x32bit -->
531 <!-- - - - - - - - - - -->
532
533 <sect2 arch="ml_x32,ml_all">
534 <title>Building Glibc - x32bit</title>
535
536 <para>Now recompile for mx32. The extracted source can be
537 reused but needs to cleaned before installing the mx32
538 version of Glibc.</para>
539
540 <para>Clear the build directory and remove artefacts from
541 previous build:</para>
542
543<screen><userinput remap="pre">rm -rf ./*
544find .. -name "*.a" -delete</userinput></screen>
545
546 <para>Configure Glibc for mx32 with the following commands:</para>
547
548<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \
549../configure \
550 --prefix=/usr \
551 --host=x86_64-pc-linux-gnux32 \
552 --build=$(../scripts/config.guess) \
553 --enable-kernel=&min-kernel; \
554 --with-headers=$LFS/usr/include \
555 --enable-multi-arch \
556 --libdir=&usr-lib-mx32; \
557 --libexecdir=&usr-lib-mx32; \
558 libc_cv_slibdir=&lib-mx32;</userinput></screen>
559
560 <para>Compile the package:</para>
561
562<screen><userinput remap="make">make</userinput></screen>
563
564 <para>Install the package:</para>
565
566<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
567cp -a DESTDIR&lib-mx32;/* &lib-mx32;/
568cp -a DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;/
569install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
570 /usr/include/gnu/
571ln -svf ..&lib-mx32;/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2</userinput></screen>
572
573 <para>Add the library name to the dynamic loader config:</para>
574
575<screen role="install"><userinput>echo "&usr-lib-mx32;" &gt;&gt; /etc/ld.so.conf</userinput></screen>
576
577 <caution>
578 <para>At this point, it is imperative to stop and ensure that the basic
579 functions (compiling and linking) of the new toolchain are working as
580 expected. To perform a sanity check, run the following commands:</para>
581
582<screen><userinput>echo 'int main(){}' &gt; dummy.c
583gcc -mx32 dummy.c
584readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
585
586 <para>If everything is working correctly, there should be no errors,
587 and the output of the last command will be of the form:</para>
588
589<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux-x32.so.2]</computeroutput></screen>
590
591 <para>If the output is not shown as above or there was no output at all,
592 then something is wrong. Investigate and retrace the steps to find out
593 where the problem is and correct it. This issue must be resolved before
594 continuing on.</para>
595
596 <para>Once all is well, clean up the test files:</para>
597
598<screen><userinput>rm -v dummy.c a.out</userinput></screen>
599
600 </caution>
601
602 </sect2><!-- mx32 -->
603
[6a82dd9]604 <sect2 id="contents-glibc" role="content">
605 <title>Contents of Glibc</title>
606
607 <segmentedlist>
608 <segtitle>Installed programs</segtitle>
609 <segtitle>Installed libraries</segtitle>
[fe05b08]610 <segtitle>Installed directories</segtitle>
[6a82dd9]611
612 <seglistitem>
613 <seg>catchsegv, gencat, getconf, getent, iconv, iconvconfig, ldconfig,
[5bf238b]614 ldd, lddlibc4, locale, localedef, makedb, mtrace, nscd,
[78cc3be]615 pcprofiledump, pldd, sln, sotruss, sprof, tzselect, xtrace,
[6a82dd9]616 zdump, and zic</seg>
[5ef820b]617 <seg>ld-&glibc-version;.so, libBrokenLocale.{a,so}, libSegFault.so, libanl.{a,so},
[78cc3be]618 libc.{a,so}, libc_nonshared.a,
619 libcrypt.{a,so}, libdl.{a,so}, libg.a, libm.{a,so},
620 libmcheck.a, libmemusage.so, libmvec.{a,so}, libnsl.{a,so},
621 libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so,
622 libpcprofile.so, libpthread.{a,so},
623 libpthread_nonshared.a, libresolv.{a,so}, librt.{a,so},
[2791a8e]624 libthread_db.so, and libutil.{a,so}</seg>
[fe05b08]625 <seg>/usr/include/arpa, /usr/include/bits, /usr/include/gnu,
626 /usr/include/net, /usr/include/netash, /usr/include/netatalk,
627 /usr/include/netax25, /usr/include/neteconet, /usr/include/netinet,
628 /usr/include/netipx, /usr/include/netiucv, /usr/include/netpacket,
629 /usr/include/netrom, /usr/include/netrose, /usr/include/nfs,
[78cc3be]630 /usr/include/protocols, /usr/include/rpc,
[4028929]631 /usr/include/sys, /usr/lib/audit, /usr/lib/gconv, /usr/lib/locale,
632 /usr/libexec/getconf, /usr/share/i18n, /usr/share/zoneinfo,
[7bb9fda]633 /var/cache/nscd, and /var/lib/nss_db</seg>
[6a82dd9]634 </seglistitem>
635 </segmentedlist>
636
637 <variablelist>
638 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
639 <?dbfo list-presentation="list"?>
640 <?dbhtml list-presentation="table"?>
641
642 <varlistentry id="catchsegv">
643 <term><command>catchsegv</command></term>
644 <listitem>
645 <para>Can be used to create a stack trace when a program
646 terminates with a segmentation fault</para>
647 <indexterm zone="ch-system-glibc catchsegv">
648 <primary sortas="b-catchsegv">catchsegv</primary>
649 </indexterm>
650 </listitem>
651 </varlistentry>
652
653 <varlistentry id="gencat">
654 <term><command>gencat</command></term>
655 <listitem>
656 <para>Generates message catalogues</para>
657 <indexterm zone="ch-system-glibc gencat">
658 <primary sortas="b-gencat">gencat</primary>
659 </indexterm>
660 </listitem>
661 </varlistentry>
662
663 <varlistentry id="getconf">
664 <term><command>getconf</command></term>
665 <listitem>
666 <para>Displays the system configuration values for file system
667 specific variables</para>
668 <indexterm zone="ch-system-glibc getconf">
669 <primary sortas="b-getconf">getconf</primary>
670 </indexterm>
671 </listitem>
672 </varlistentry>
673
674 <varlistentry id="getent">
675 <term><command>getent</command></term>
676 <listitem>
677 <para>Gets entries from an administrative database</para>
678 <indexterm zone="ch-system-glibc getent">
679 <primary sortas="b-getent">getent</primary>
680 </indexterm>
681 </listitem>
682 </varlistentry>
683
684 <varlistentry id="iconv">
685 <term><command>iconv</command></term>
686 <listitem>
687 <para>Performs character set conversion</para>
688 <indexterm zone="ch-system-glibc iconv">
689 <primary sortas="b-iconv">iconv</primary>
690 </indexterm>
691 </listitem>
692 </varlistentry>
693
694 <varlistentry id="iconvconfig">
695 <term><command>iconvconfig</command></term>
696 <listitem>
697 <para>Creates fastloading <command>iconv</command> module configuration
698 files</para>
699 <indexterm zone="ch-system-glibc iconvconfig">
700 <primary sortas="b-iconvconfig">iconvconfig</primary>
701 </indexterm>
702 </listitem>
703 </varlistentry>
704
705 <varlistentry id="ldconfig">
706 <term><command>ldconfig</command></term>
707 <listitem>
708 <para>Configures the dynamic linker runtime bindings</para>
709 <indexterm zone="ch-system-glibc ldconfig">
710 <primary sortas="b-ldconfig">ldconfig</primary>
711 </indexterm>
712 </listitem>
713 </varlistentry>
714
715 <varlistentry id="ldd">
716 <term><command>ldd</command></term>
717 <listitem>
718 <para>Reports which shared libraries are required
719 by each given program or shared library</para>
720 <indexterm zone="ch-system-glibc ldd">
721 <primary sortas="b-ldd">ldd</primary>
722 </indexterm>
723 </listitem>
724 </varlistentry>
725
726 <varlistentry id="lddlibc4">
727 <term><command>lddlibc4</command></term>
728 <listitem>
729 <para>Assists <command>ldd</command> with object files</para>
730 <indexterm zone="ch-system-glibc lddlibc4">
731 <primary sortas="b-lddlibc4">lddlibc4</primary>
732 </indexterm>
733 </listitem>
734 </varlistentry>
735
736 <varlistentry id="locale">
737 <term><command>locale</command></term>
738 <listitem>
739 <para>Prints various information about the current locale</para>
740 <indexterm zone="ch-system-glibc locale">
741 <primary sortas="b-locale">locale</primary>
742 </indexterm>
743 </listitem>
744 </varlistentry>
745
746 <varlistentry id="localedef">
747 <term><command>localedef</command></term>
748 <listitem>
749 <para>Compiles locale specifications</para>
750 <indexterm zone="ch-system-glibc localedef">
751 <primary sortas="b-localedef">localedef</primary>
752 </indexterm>
753 </listitem>
754 </varlistentry>
755
[ca101ad]756 <varlistentry id="makedb">
757 <term><command>makedb</command></term>
758 <listitem>
759 <para>Creates a simple database from textual input</para>
760 <indexterm zone="ch-system-glibc makedb">
761 <primary sortas="b-makedb">makedb</primary>
762 </indexterm>
763 </listitem>
764 </varlistentry>
765
[6a82dd9]766 <varlistentry id="mtrace">
767 <term><command>mtrace</command></term>
768 <listitem>
769 <para>Reads and interprets a memory trace file and displays a summary
770 in human-readable format</para>
771 <indexterm zone="ch-system-glibc mtrace">
772 <primary sortas="b-mtrace">mtrace</primary>
773 </indexterm>
774 </listitem>
775 </varlistentry>
776
777 <varlistentry id="nscd">
778 <term><command>nscd</command></term>
779 <listitem>
780 <para>A daemon that provides a cache for the most common name
781 service requests</para>
782 <indexterm zone="ch-system-glibc nscd">
783 <primary sortas="b-nscd">nscd</primary>
784 </indexterm>
785 </listitem>
786 </varlistentry>
[1118b17]787
[78cc3be]788 <varlistentry id="pcprofiledump">
789 <term><command>pcprofiledump</command></term>
790 <listitem>
791 <para>Dump information generated by PC profiling</para>
792 <indexterm zone="ch-system-glibc pcprofiledump">
793 <primary sortas="b-pcprofiledump">pcprofiledump</primary>
794 </indexterm>
795 </listitem>
796 </varlistentry>
797
[ca101ad]798 <varlistentry id="pldd">
799 <term><command>pldd</command></term>
800 <listitem>
801 <para>Lists dynamic shared objects used by running processes</para>
802 <indexterm zone="ch-system-glibc pldd">
803 <primary sortas="b-pldd">pldd</primary>
804 </indexterm>
805 </listitem>
806 </varlistentry>
[1118b17]807
[6a82dd9]808 <varlistentry id="sln">
809 <term><command>sln</command></term>
810 <listitem>
811 <para>A statically linked <command>ln</command> program</para>
812 <indexterm zone="ch-system-glibc sln">
813 <primary sortas="b-sln">sln</primary>
814 </indexterm>
815 </listitem>
816 </varlistentry>
817
[3119ddc]818 <varlistentry id="sotruss">
819 <term><command>sotruss</command></term>
820 <listitem>
821 <para>Traces shared library procedure calls of a specified command</para>
822 <indexterm zone="ch-system-glibc sotruss">
823 <primary sortas="b-sotruss">sotruss</primary>
824 </indexterm>
825 </listitem>
826 </varlistentry>
827
[6a82dd9]828 <varlistentry id="sprof">
829 <term><command>sprof</command></term>
830 <listitem>
831 <para>Reads and displays shared object profiling data</para>
832 <indexterm zone="ch-system-glibc sprof">
833 <primary sortas="b-sprof">sprof</primary>
834 </indexterm>
835 </listitem>
836 </varlistentry>
837
838 <varlistentry id="tzselect">
839 <term><command>tzselect</command></term>
840 <listitem>
841 <para>Asks the user about the location of the system and reports
842 the corresponding time zone description</para>
843 <indexterm zone="ch-system-glibc tzselect">
844 <primary sortas="b-tzselect">tzselect</primary>
845 </indexterm>
846 </listitem>
847 </varlistentry>
848
849 <varlistentry id="xtrace">
850 <term><command>xtrace</command></term>
851 <listitem>
852 <para>Traces the execution of a program by printing the currently
853 executed function</para>
854 <indexterm zone="ch-system-glibc xtrace">
855 <primary sortas="b-xtrace">xtrace</primary>
856 </indexterm>
857 </listitem>
858 </varlistentry>
859
860 <varlistentry id="zdump">
861 <term><command>zdump</command></term>
862 <listitem>
863 <para>The time zone dumper</para>
864 <indexterm zone="ch-system-glibc zdump">
865 <primary sortas="b-zdump">zdump</primary>
866 </indexterm>
867 </listitem>
868 </varlistentry>
869
870 <varlistentry id="zic">
871 <term><command>zic</command></term>
872 <listitem>
873 <para>The time zone compiler</para>
874 <indexterm zone="ch-system-glibc zic">
875 <primary sortas="b-zic">zic</primary>
876 </indexterm>
877 </listitem>
878 </varlistentry>
879
880 <varlistentry id="ld.so">
[5ef820b]881 <term><filename class="libraryfile">ld-&glibc-version;.so</filename></term>
[6a82dd9]882 <listitem>
883 <para>The helper program for shared library executables</para>
884 <indexterm zone="ch-system-glibc ld.so">
[5ef820b]885 <primary sortas="c-ld.so">ld-&glibc-version;.so</primary>
[6a82dd9]886 </indexterm>
887 </listitem>
888 </varlistentry>
889
890 <varlistentry id="libBrokenLocale">
891 <term><filename class="libraryfile">libBrokenLocale</filename></term>
892 <listitem>
893 <para>Used internally by Glibc as a gross hack to get broken programs
894 (e.g., some Motif applications) running. See comments in
895 <filename>glibc-&glibc-version;/locale/broken_cur_max.c</filename>
896 for more information</para>
897 <indexterm zone="ch-system-glibc libBrokenLocale">
898 <primary sortas="c-libBrokenLocale">libBrokenLocale</primary>
899 </indexterm>
900 </listitem>
901 </varlistentry>
902
903 <varlistentry id="libSegFault">
904 <term><filename class="libraryfile">libSegFault</filename></term>
905 <listitem>
906 <para>The segmentation fault signal handler, used by
907 <command>catchsegv</command></para>
908 <indexterm zone="ch-system-glibc libSegFault">
909 <primary sortas="c-libSegFault">libSegFault</primary>
910 </indexterm>
911 </listitem>
912 </varlistentry>
913
914 <varlistentry id="libanl">
915 <term><filename class="libraryfile">libanl</filename></term>
916 <listitem>
917 <para>An asynchronous name lookup library</para>
918 <indexterm zone="ch-system-glibc libanl">
919 <primary sortas="c-libanl">libanl</primary>
920 </indexterm>
921 </listitem>
922 </varlistentry>
923
924 <varlistentry id="libc">
925 <term><filename class="libraryfile">libc</filename></term>
926 <listitem>
927 <para>The main C library</para>
928 <indexterm zone="ch-system-glibc libc">
929 <primary sortas="c-libc">libc</primary>
930 </indexterm>
931 </listitem>
932 </varlistentry>
933
934 <varlistentry id="libcrypt">
935 <term><filename class="libraryfile">libcrypt</filename></term>
936 <listitem>
937 <para>The cryptography library</para>
938 <indexterm zone="ch-system-glibc libcrypt">
939 <primary sortas="c-libcrypt">libcrypt</primary>
940 </indexterm>
941 </listitem>
942 </varlistentry>
943
944 <varlistentry id="libdl">
945 <term><filename class="libraryfile">libdl</filename></term>
946 <listitem>
947 <para>The dynamic linking interface library</para>
948 <indexterm zone="ch-system-glibc libdl">
949 <primary sortas="c-libdl">libdl</primary>
950 </indexterm>
951 </listitem>
952 </varlistentry>
953
954 <varlistentry id="libg">
955 <term><filename class="libraryfile">libg</filename></term>
956 <listitem>
957 <para>Dummy library containing no functions. Previously was a runtime
958 library for <command>g++</command></para>
959 <indexterm zone="ch-system-glibc libg">
960 <primary sortas="c-libg">libg</primary>
961 </indexterm>
962 </listitem>
963 </varlistentry>
964
965 <varlistentry id="libm">
966 <term><filename class="libraryfile">libm</filename></term>
967 <listitem>
968 <para>The mathematical library</para>
969 <indexterm zone="ch-system-glibc libm">
970 <primary sortas="c-libm">libm</primary>
971 </indexterm>
972 </listitem>
973 </varlistentry>
974
975 <varlistentry id="libmcheck">
976 <term><filename class="libraryfile">libmcheck</filename></term>
977 <listitem>
978 <para>Turns on memory allocation checking when linked to</para>
979 <indexterm zone="ch-system-glibc libmcheck">
980 <primary sortas="c-libmcheck">libmcheck</primary>
981 </indexterm>
982 </listitem>
983 </varlistentry>
984
985 <varlistentry id="libmemusage">
986 <term><filename class="libraryfile">libmemusage</filename></term>
987 <listitem>
988 <para>Used by <command>memusage</command> to help collect
989 information about the memory usage of a program</para>
990 <indexterm zone="ch-system-glibc libmemusage">
991 <primary sortas="c-libmemusage">libmemusage</primary>
992 </indexterm>
993 </listitem>
994 </varlistentry>
995
996 <varlistentry id="libnsl">
997 <term><filename class="libraryfile">libnsl</filename></term>
998 <listitem>
999 <para>The network services library</para>
1000 <indexterm zone="ch-system-glibc libnsl">
1001 <primary sortas="c-libnsl">libnsl</primary>
1002 </indexterm>
1003 </listitem>
1004 </varlistentry>
1005
1006 <varlistentry id="libnss">
1007 <term><filename class="libraryfile">libnss</filename></term>
1008 <listitem>
1009 <para>The Name Service Switch libraries, containing functions for
1010 resolving host names, user names, group names, aliases, services,
1011 protocols, etc.</para>
1012 <indexterm zone="ch-system-glibc libnss">
1013 <primary sortas="c-libnss">libnss</primary>
1014 </indexterm>
1015 </listitem>
1016 </varlistentry>
[1118b17]1017
[78cc3be]1018 <varlistentry id="libpcprofile">
1019 <term><filename class="libraryfile">libpcprofile</filename></term>
1020 <listitem>
1021 <para>Can be preloaded to PC profile an executable</para>
1022 <indexterm zone="ch-system-glibc libpcprofile">
1023 <primary sortas="c-libpcprofile">libpcprofile</primary>
1024 </indexterm>
1025 </listitem>
1026 </varlistentry>
1027
[6a82dd9]1028 <varlistentry id="libpthread">
1029 <term><filename class="libraryfile">libpthread</filename></term>
1030 <listitem>
1031 <para>The POSIX threads library</para>
1032 <indexterm zone="ch-system-glibc libpthread">
1033 <primary sortas="c-libpthread">libpthread</primary>
1034 </indexterm>
1035 </listitem>
1036 </varlistentry>
1037
1038 <varlistentry id="libresolv">
1039 <term><filename class="libraryfile">libresolv</filename></term>
1040 <listitem>
1041 <para>Contains functions for creating, sending, and interpreting
1042 packets to the Internet domain name servers</para>
1043 <indexterm zone="ch-system-glibc libresolv">
1044 <primary sortas="c-libresolv">libresolv</primary>
1045 </indexterm>
1046 </listitem>
1047 </varlistentry>
1048
1049 <varlistentry id="librt">
1050 <term><filename class="libraryfile">librt</filename></term>
1051 <listitem>
1052 <para>Contains functions providing most of the interfaces specified
1053 by the POSIX.1b Realtime Extension</para>
1054 <indexterm zone="ch-system-glibc librt">
1055 <primary sortas="c-librt">librt</primary>
1056 </indexterm>
1057 </listitem>
1058 </varlistentry>
1059
1060 <varlistentry id="libthread_db">
1061 <term><filename class="libraryfile">libthread_db</filename></term>
1062 <listitem>
1063 <para>Contains functions useful for building debuggers for
1064 multi-threaded programs</para>
1065 <indexterm zone="ch-system-glibc libthread_db">
1066 <primary sortas="c-libthread_db">libthread_db</primary>
1067 </indexterm>
1068 </listitem>
1069 </varlistentry>
1070
1071 <varlistentry id="libutil">
1072 <term><filename class="libraryfile">libutil</filename></term>
1073 <listitem>
1074 <para>Contains code for <quote>standard</quote> functions used in
1075 many different Unix utilities</para>
1076 <indexterm zone="ch-system-glibc libutil">
1077 <primary sortas="c-libutil">libutil</primary>
1078 </indexterm>
1079 </listitem>
1080 </varlistentry>
1081
1082 </variablelist>
1083
1084 </sect2>
[673b0d8]1085
1086</sect1>
Note: See TracBrowser for help on using the repository browser.