source: chapter08/glibc.xml@ 88bdbb7

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

Automatic merge of trunk into multilib

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