aboutsummaryrefslogtreecommitdiffstats
path: root/chapter05/glibc.xml
diff options
context:
space:
mode:
Diffstat (limited to 'chapter05/glibc.xml')
-rw-r--r--chapter05/glibc.xml159
1 files changed, 156 insertions, 3 deletions
diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml
index 14f1fac6c..0339a7b22 100644
--- a/chapter05/glibc.xml
+++ b/chapter05/glibc.xml
@@ -47,13 +47,16 @@
for x86_64, create a compatibility symbolic link required for proper
operation of the dynamic library loader:</para>
-<screen><userinput remap="pre">case $(uname -m) in
+<screen arch="default"><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>
+<!-- no ld-linux.so.2 here as multilib is based on x86_64, not on i686 -->
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">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</userinput></screen>
<note>
<para>
@@ -85,13 +88,21 @@ cd build</userinput></screen>
<para>Next, prepare Glibc for compilation:</para>
-<screen><userinput remap="configure">../configure \
+<screen arch="default"><userinput remap="configure">../configure \
--prefix=/usr \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=$LFS/usr/include \
libc_cv_slibdir=/usr/lib</userinput></screen>
+<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure \
+ --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(../scripts/config.guess) \
+ --enable-kernel=&min-kernel; \
+ --with-headers=$LFS/usr/include \
+ --enable-multi-arch \
+ libc_cv_slibdir=/usr/lib</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
@@ -203,7 +214,7 @@ readelf -l a.out | grep ld-linux</userinput></screen>
<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
- <para>Note that for 32-bit machines, the interpreter name will be
+ <para arch="default">Note that for 32-bit machines, the interpreter name will be
<filename>/lib/ld-linux.so.2</filename>.</para>
<para>If the output is not as shown above, or there is no output at all,
@@ -231,6 +242,148 @@ readelf -l a.out | grep ld-linux</userinput></screen>
-->
</sect2>
+ <!-- - - - - - - - - - -->
+ <!-- Multilib - 32bit -->
+ <!-- - - - - - - - - - -->
+ <sect2 arch="ml_32,ml_all">
+ <title>Building Glibc - 32bit</title>
+
+ <para>Now recompile for m32. The extracted source can be
+ reused but needs to be cleaned before installing the m32
+ version of Glibc.</para>
+
+ <para>Clear the build directory and remove artefacts from
+ previous build:</para>
+
+<screen><userinput remap="pre">make clean
+find .. -name "*.a" -delete</userinput></screen>
+
+ <para>Configure Glibc for m32 with the following commands:</para>
+
+<screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \
+CXX="$LFS_TGT-g++ -m32" \
+../configure \
+ --prefix=/usr \
+ --host=$LFS_TGT32 \
+ --build=$(../scripts/config.guess) \
+ --enable-kernel=&min-kernel; \
+ --with-headers=$LFS/usr/include \
+ --enable-multi-arch \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ libc_cv_slibdir=/usr/lib32</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -a DESTDIR/usr/lib32 $LFS/usr/
+install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
+ $LFS/usr/include/gnu/
+ln -svf ../lib32/ld-linux.so.2 $LFS/lib/ld-linux.so.2</userinput></screen>
+
+
+ <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>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc -m32 dummy.c
+readelf -l a.out | grep '/ld-linux'</userinput></screen>
+
+ <para>If everything is working correctly, there should be no errors,
+ and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
+
+ <para>If the output is not shown as above or there was no output at all,
+ 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
+ continuing on.</para>
+
+ <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+ </caution>
+
+ </sect2><!-- m32 -->
+
+ <!-- - - - - - - - - - -->
+ <!-- Multilib - x32bit -->
+ <!-- - - - - - - - - - -->
+
+ <sect2 arch="ml_x32,ml_all">
+ <title>Building Glibc - x32bit</title>
+
+ <para>Now recompile for mx32. The extracted source can be
+ reused but needs to be cleaned before installing the mx32
+ version of Glibc.</para>
+
+ <para>Clear the build directory and remove artefacts from
+ previous build:</para>
+
+<screen><userinput remap="pre">make clean
+find .. -name "*.a" -delete</userinput></screen>
+
+ <para>Configure Glibc for mx32 with the following commands:</para>
+
+<screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \
+CXX="$LFS_TGT-g++ -mx32" \
+../configure \
+ --prefix=/usr \
+ --host=$LFS_TGTX32 \
+ --build=$(../scripts/config.guess) \
+ --enable-kernel=&min-kernel; \
+ --with-headers=$LFS/usr/include \
+ --enable-multi-arch \
+ --libdir=/usr/libx32 \
+ --libexecdir=/usr/libx32 \
+ libc_cv_slibdir=/usr/libx32</userinput></screen>
+
+ <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+ <para>Install the package:</para>
+
+<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
+cp -a DESTDIR/usr/libx32 $LFS/usr/
+install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
+ $LFS/usr/include/gnu/
+ln -svf ../libx32/ld-linux-x32.so.2 $LFS/lib/ld-linux-x32.so.2</userinput></screen>
+
+ <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>
+
+<screen><userinput>echo 'int main(){}' &gt; dummy.c
+$LFS_TGT-gcc -mx32 dummy.c
+readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
+
+ <para>If everything is working correctly, there should be no errors,
+ and the output of the last command will be of the form:</para>
+
+<screen><computeroutput>[Requesting program interpreter: /libx32/ld-linux-x32.so.2]</computeroutput></screen>
+
+ <para>If the output is not shown as above or there was no output at all,
+ 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
+ continuing on.</para>
+
+ <para>Once all is well, clean up the test files:</para>
+
+<screen><userinput>rm -v dummy.c a.out</userinput></screen>
+
+ </caution>
+
+ </sect2><!-- mx32 -->
+
<sect2 role="content">
<title/>