2024-01-18 19:53:23 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
2007-03-21 18:42:58 +00:00
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
2004-05-03 11:59:46 +01:00
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
2006-01-20 21:02:23 +00:00
|
|
|
|
2004-05-16 01:06:08 +01:00
|
|
|
<sect1 id="ch-tools-glibc" role="wrap">
|
2006-01-20 21:02:23 +00:00
|
|
|
<?dbhtml filename="glibc.html"?>
|
|
|
|
|
2007-09-07 20:16:43 +01:00
|
|
|
<sect1info condition="script">
|
|
|
|
<productname>glibc</productname>
|
|
|
|
<productnumber>&glibc-version;</productnumber>
|
|
|
|
<address>&glibc-url;</address>
|
|
|
|
</sect1info>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<title>Glibc-&glibc-version;</title>
|
|
|
|
|
|
|
|
<indexterm zone="ch-tools-glibc">
|
|
|
|
<primary sortas="a-Glibc">Glibc</primary>
|
|
|
|
<secondary>tools</secondary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<sect2 role="package">
|
|
|
|
<title/>
|
2003-05-02 19:20:20 +01:00
|
|
|
|
2010-04-21 21:16:28 +01:00
|
|
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
2020-06-07 21:16:00 +01:00
|
|
|
href="../chapter08/glibc.xml"
|
2006-01-20 21:02:23 +00:00
|
|
|
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<segmentedlist>
|
|
|
|
<segtitle>&buildtime;</segtitle>
|
|
|
|
<segtitle>&diskspace;</segtitle>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<seglistitem>
|
2020-06-11 13:55:28 +01:00
|
|
|
<seg>&glibc-tmp-sbu;</seg>
|
|
|
|
<seg>&glibc-tmp-du;</seg>
|
2006-01-20 21:02:23 +00:00
|
|
|
</seglistitem>
|
|
|
|
</segmentedlist>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</sect2>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<sect2 role="installation">
|
|
|
|
<title>Installation of Glibc</title>
|
2015-08-23 22:26:36 +01:00
|
|
|
|
2020-06-15 06:23:47 +01:00
|
|
|
<para>First, create a symbolic link for LSB compliance. Additionally,
|
|
|
|
for x86_64, create a compatibility symbolic link required for proper
|
2020-05-03 22:02:51 +01:00
|
|
|
operation of the dynamic library loader:</para>
|
|
|
|
|
2020-06-15 06:23:47 +01:00
|
|
|
<screen><userinput remap="pre">case $(uname -m) in
|
|
|
|
i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
|
|
|
|
;;
|
|
|
|
x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
|
|
|
|
ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
|
|
|
|
;;
|
|
|
|
esac</userinput></screen>
|
2020-05-03 22:02:51 +01:00
|
|
|
|
2021-11-11 16:38:18 +00:00
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
The above command is correct. The <command>ln</command> command has
|
2022-10-30 14:23:55 +00:00
|
|
|
several syntactic versions, so be sure to check
|
2024-01-25 17:49:29 +00:00
|
|
|
<command>info coreutils ln</command> and <ulink role='man'
|
|
|
|
url='&man;ln.1'>ln(1)</ulink> before reporting what may appear to be
|
|
|
|
an error.
|
2021-11-11 16:38:18 +00:00
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
|
2022-10-30 14:23:55 +00:00
|
|
|
<para>Some of the Glibc programs use the non-FHS-compliant
|
2020-05-03 22:02:51 +01:00
|
|
|
<filename class="directory">/var/db</filename> directory to store their
|
|
|
|
runtime data. Apply the following patch to make such programs store their
|
|
|
|
runtime data in the FHS-compliant locations:</para>
|
|
|
|
|
|
|
|
<screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen>
|
|
|
|
|
2021-09-07 21:43:31 +01:00
|
|
|
<para>The Glibc documentation recommends building Glibc
|
2016-01-27 21:49:38 +00:00
|
|
|
in a dedicated build directory:</para>
|
2012-03-29 07:46:19 +01:00
|
|
|
|
2016-01-27 21:49:38 +00:00
|
|
|
<screen><userinput remap="pre">mkdir -v build
|
|
|
|
cd build</userinput></screen>
|
2012-08-05 15:25:02 +01:00
|
|
|
|
2021-07-22 02:02:02 +01:00
|
|
|
<para>Ensure that the <command>ldconfig</command> and <command>sln</command>
|
2022-03-24 17:11:57 +00:00
|
|
|
utilities are installed into
|
2021-07-22 02:02:02 +01:00
|
|
|
<filename class="directory">/usr/sbin</filename>:</para>
|
|
|
|
|
|
|
|
<screen><userinput remap="pre">echo "rootsbindir=/usr/sbin" > configparms</userinput></screen>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Next, prepare Glibc for compilation:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2016-01-31 16:32:45 +00:00
|
|
|
<screen><userinput remap="configure">../configure \
|
2020-05-03 22:02:51 +01:00
|
|
|
--prefix=/usr \
|
2016-01-31 16:32:45 +00:00
|
|
|
--host=$LFS_TGT \
|
|
|
|
--build=$(../scripts/config.guess) \
|
2023-06-05 16:20:48 +01:00
|
|
|
--enable-kernel=&min-kernel; \
|
2020-05-03 22:02:51 +01:00
|
|
|
--with-headers=$LFS/usr/include \
|
2023-10-01 19:37:57 +01:00
|
|
|
--disable-nscd \
|
2021-05-14 15:44:01 +01:00
|
|
|
libc_cv_slibdir=/usr/lib</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<variablelist>
|
|
|
|
<title>The meaning of the configure options:</title>
|
|
|
|
|
2008-12-05 20:46:02 +00:00
|
|
|
<varlistentry>
|
2016-01-31 16:24:19 +00:00
|
|
|
<term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
|
2008-12-05 20:46:02 +00:00
|
|
|
<listitem>
|
|
|
|
<para>The combined effect of these switches is that Glibc's build system
|
2020-05-03 22:02:51 +01:00
|
|
|
configures itself to be cross-compiled, using the cross-linker and
|
2020-06-19 18:53:34 +01:00
|
|
|
cross-compiler in <filename class="directory">$LFS/tools</filename>.</para>
|
2008-12-05 20:46:02 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2016-05-24 22:24:59 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<varlistentry>
|
2013-08-22 16:17:25 +01:00
|
|
|
<term><parameter>--enable-kernel=&min-kernel;</parameter></term>
|
2006-01-20 21:02:23 +00:00
|
|
|
<listitem>
|
|
|
|
<para>This tells Glibc to compile the library with support
|
2013-08-22 16:17:25 +01:00
|
|
|
for &min-kernel; and later Linux kernels. Workarounds for older
|
2009-06-07 00:38:23 +01:00
|
|
|
kernels are not enabled.</para>
|
2006-01-20 21:02:23 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2016-05-24 22:24:59 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<varlistentry>
|
2020-05-03 22:02:51 +01:00
|
|
|
<term><parameter>--with-headers=$LFS/usr/include</parameter></term>
|
2006-01-20 21:02:23 +00:00
|
|
|
<listitem>
|
2020-06-13 09:55:55 +01:00
|
|
|
<para>This tells Glibc to compile itself against the headers
|
|
|
|
recently installed to the $LFS/usr/include directory, so that
|
|
|
|
it knows exactly what features the kernel has and can optimize
|
|
|
|
itself accordingly.</para>
|
2006-01-20 21:02:23 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2020-05-03 22:02:51 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<varlistentry>
|
2021-05-12 05:24:11 +01:00
|
|
|
<term><parameter>libc_cv_slibdir=/usr/lib</parameter></term>
|
2006-01-20 21:02:23 +00:00
|
|
|
<listitem>
|
2021-05-12 05:24:11 +01:00
|
|
|
<para>This ensures that the library is installed in /usr/lib instead
|
2022-10-30 14:23:55 +00:00
|
|
|
of the default /lib64 on 64-bit machines.</para>
|
2008-12-05 20:46:02 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2006-01-20 21:02:23 +00:00
|
|
|
|
2023-10-01 19:37:57 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>--disable-nscd</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>Do not build the name service cache daemon which is no
|
|
|
|
longer used.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
<para>During this stage the following warning might appear:</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<screen><computeroutput>configure: WARNING:
|
|
|
|
*** These auxiliary programs are missing or
|
2005-02-19 22:16:42 +00:00
|
|
|
*** incompatible versions: msgfmt
|
|
|
|
*** some features will be disabled.
|
2006-01-20 21:02:23 +00:00
|
|
|
*** Check the INSTALL file for required versions.</computeroutput></screen>
|
|
|
|
</blockquote>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>The missing or incompatible <command>msgfmt</command> program is
|
2009-08-12 20:16:30 +01:00
|
|
|
generally harmless. This <command>msgfmt</command> program is part of the
|
2022-10-30 14:23:55 +00:00
|
|
|
Gettext package, which the host distribution should provide.</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2021-09-07 21:43:31 +01:00
|
|
|
<note><para>There have been reports that this package may fail when
|
2024-01-26 17:28:53 +00:00
|
|
|
building as a <quote>parallel make.</quote> If that occurs, rerun the make command
|
|
|
|
with the <option>-j1</option> option.</para></note>
|
2015-02-16 21:32:19 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Compile the package:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="make">make</userinput></screen>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Install the package:</para>
|
2003-11-01 22:31:50 +00:00
|
|
|
|
2020-06-12 05:40:07 +01:00
|
|
|
<warning><para>If <envar>LFS</envar> is not properly set, and despite the
|
2020-12-26 15:51:54 +00:00
|
|
|
recommendations, you are building as
|
|
|
|
<systemitem class="username">root</systemitem>, the next command will
|
2022-10-30 14:23:55 +00:00
|
|
|
install the newly built Glibc to your host system, which will almost
|
|
|
|
certainly render it unusable. So double-check that the environment is
|
|
|
|
correctly set, and that you are not &root;, before running the following command.</para></warning>
|
2020-06-08 21:42:12 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<title>The meaning of the <command>make install</command> option:</title>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>DESTDIR=$LFS</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>The <envar>DESTDIR</envar> make variable is used by almost all
|
|
|
|
packages to define the location where the package should be
|
|
|
|
installed. If it is not set, it defaults to the root (<filename
|
|
|
|
class="directory">/</filename>) directory. Here we specify that
|
2024-10-25 17:37:55 +01:00
|
|
|
the package is installed in <filename class="directory">
|
|
|
|
$LFS</filename>, which will become the root directory in <xref linkend=
|
2020-05-03 22:02:51 +01:00
|
|
|
"ch-tools-chroot"/>.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
2021-05-14 11:54:44 +01:00
|
|
|
|
2022-10-30 14:23:55 +00:00
|
|
|
<para>Fix a hard coded path to the executable loader in the
|
2021-05-13 16:26:54 +01:00
|
|
|
<command>ldd</command> script:</para>
|
|
|
|
|
|
|
|
<screen><userinput remap="install">sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd</userinput></screen>
|
2021-05-14 11:54:44 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<caution>
|
|
|
|
<para>At this point, it is imperative to stop and ensure that the basic
|
|
|
|
functions (compiling and linking) of the new toolchain are working as
|
|
|
|
expected. To perform a sanity check, run the following commands:</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2022-10-06 08:07:42 +01:00
|
|
|
<screen><userinput>echo 'int main(){}' | $LFS_TGT-gcc -xc -
|
2022-08-25 08:24:58 +01:00
|
|
|
readelf -l a.out | grep ld-linux</userinput></screen>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<para>If everything is working correctly, there should be no errors,
|
|
|
|
and the output of the last command will be of the form:</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<para>Note that for 32-bit machines, the interpreter name will be
|
|
|
|
<filename>/lib/ld-linux.so.2</filename>.</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2022-10-30 14:23:55 +00:00
|
|
|
<para>If the output is not as shown above, or there is no output at all,
|
2020-05-03 22:02:51 +01:00
|
|
|
then something is wrong. Investigate and retrace the steps to find out
|
|
|
|
where the problem is and correct it. This issue must be resolved before
|
2022-10-30 14:23:55 +00:00
|
|
|
continuing.</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2022-08-25 08:24:58 +01:00
|
|
|
<para>Once all is well, clean up the test file:</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2022-08-25 08:24:58 +01:00
|
|
|
<screen><userinput>rm -v a.out</userinput></screen>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
</caution>
|
|
|
|
|
2022-10-30 14:23:55 +00:00
|
|
|
<note><para>Building the packages in the next chapter will serve as an
|
2020-05-03 22:02:51 +01:00
|
|
|
additional check that the toolchain has been built properly. If some
|
2022-10-30 14:23:55 +00:00
|
|
|
package, especially Binutils-pass2 or GCC-pass2, fails to build, it is
|
2020-05-03 22:02:51 +01:00
|
|
|
an indication that something has gone wrong with the
|
2022-10-30 14:23:55 +00:00
|
|
|
preceding Binutils, GCC, or Glibc installations.</para></note>
|
2023-04-27 16:01:17 +01:00
|
|
|
<!--
|
2020-05-03 22:02:51 +01:00
|
|
|
<para>Now that our cross-toolchain is complete, finalize the installation
|
2022-10-30 14:23:55 +00:00
|
|
|
of the limits.h header. To do this, run a utility provided by the GCC
|
2020-05-03 22:02:51 +01:00
|
|
|
developers:</para>
|
2012-04-25 20:26:21 +01:00
|
|
|
|
2020-05-03 22:02:51 +01:00
|
|
|
<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
|
2023-04-27 16:01:17 +01:00
|
|
|
-->
|
2006-01-20 21:02:23 +00:00
|
|
|
</sect2>
|
2003-05-02 19:20:20 +01:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<sect2 role="content">
|
|
|
|
<title/>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
<para>Details on this package are located in
|
|
|
|
<xref linkend="contents-glibc" role="."/></para>
|
|
|
|
|
|
|
|
</sect2>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2006-01-20 21:02:23 +00:00
|
|
|
</sect1>
|