source: chapter08/glibc.xml@ ea6fdf5

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

Automatic merge of trunk into multilib

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