source: chapter08/glibc.xml@ df462a9

ml-11.0 multilib
Last change on this file since df462a9 was df462a9, checked in by Thomas Trepl (Moody) <thomas@…>, 3 years ago

Merge pre-LFS-11-0 changes

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