source: chapter08/glibc.xml@ f8a76cb

multilib
Last change on this file since f8a76cb was f8a76cb, checked in by Thomas Trepl <thomas@…>, 8 months ago

Automatic merge of trunk into multilib

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