glibc.xml 40 KB

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