source: chapter08/glibc.xml@ 64a306d

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

Automatic merge of trunk into multilib

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