lfs/chapter06/glibc-32.xml

164 lines
5.7 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 arch="ml_32,ml_x32,ml_all" id="ch-system-glibc-32" role="wrap">
<?dbhtml filename="glibc-32.html"?>
<sect1info condition="script">
<productname>glibc-32</productname>
<productnumber>&glibc-version;</productnumber>
<address>&glibc-url;</address>
</sect1info>
<title>Glibc-&glibc-version; - 32-bit</title>
<indexterm zone="ch-system-glibc-32">
<primary sortas="a-Glibc-32">Glibc-32</primary>
</indexterm>
<!--
<sect2 role="package">
<title/>
<para>The Glibc package contains the main C library. This library provides
the basic routines for allocating memory, searching directories, opening and
closing files, reading and writing files, string handling, pattern matching,
arithmetic, and so on.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&glibc-ch6-sbu;</seg>
<seg>&glibc-ch6-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
-->
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Glibc - 32-bit</title>
<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
<para>Remove a file that may be left over from a previous build attempt:</para>
<screen><userinput remap="pre">mv /usr/include/limits.h{,.backup} </userinput></screen>
<para>The Glibc documentation recommends building Glibc
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare Glibc for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
CXX="g++ -m32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
../configure --prefix=/usr \
--disable-werror \
--enable-kernel=&min-kernel; \
--enable-stack-protector=strong \
--enable-multi-arch \
--libdir=/usr/lib32 \
--libexecdir=/usr/lib32 \
--with-headers=/usr/include \
libc_cv_slibdir=/usr/lib32 \
i686-pc-linux-gnu</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
make install_root=$PWD/DESTDIR install
mv -v DESTDIR/usr/lib32/* /usr/lib32/
install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
/usr/include/gnu/
ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2
ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-lsb.so.3
ln -svf ../lib/locale /usr/lib32/locale</userinput></screen>
<para>Configure the linker cache configuration:</para>
<screen><userinput>echo "/usr/lib32" > /etc/ld.so.conf.d/lib32.conf
ldconfig</userinput></screen>
<para>Do cleanup:</para>
<screen><userinput>cd ..
rm -rf build</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Glibc - x32-bit</title>
<para>The Glibc documentation recommends building Glibc
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare Glibc for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
CXX="g++ -mx32 -ffile-prefix-map=/tools=/usr -isystem /usr/include" \
../configure --prefix=/usr \
--disable-werror \
--enable-kernel=&min-kernel; \
--enable-stack-protector=strong \
--enable-multi-arch \
--libdir=/usr/libx32 \
--with-headers=/usr/include \
libc_cv_slibdir=/usr/libx32 \
x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
make install_root=$PWD/DESTDIR install
mv -v DESTDIR/usr/libx32/* /usr/libx32/
install -vm644 DESTDIR/usr/include/gnu/lib-names-x32.h /usr/include/gnu/
[ -e DESTDIR/usr/include/gnu/stubs-x32.h ] \
&amp;&amp; install -vm644 DESTDIR/usr/include/gnu/stubs-x32.h /usr/include/gnu/ \
|| ln -v /usr/include/gnu/stubs-64.h /usr/include/gnu/stubs-x32.h
ln -svf ../usr/libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2
ln -svf ../lib/locale /usr/libx32/locale</userinput></screen>
<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
just a "brute force" workaraound by copying the stubs-64.h file. -->
<para>Configure the linker cache configuration:</para>
<screen><userinput>echo "/usr/libx32" > /etc/ld.so.conf.d/libx32.conf
ldconfig</userinput></screen>
<para>Do cleanup:</para>
<screen><userinput>cd ..
rm -rf build</userinput></screen>
<para>Restore the file we moved temporarily away:</para>
<screen><userinput remap="pre">mv /usr/include/limits.h{.backup,} </userinput></screen>
</sect2>
</sect1>