source: chapter08/glibc.xml@ 0ebda11

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

Remove entities for multilib pathes
Add usage of libc_cv_rtlddir

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