diff options
52 files changed, 2525 insertions, 40 deletions
@@ -34,6 +34,19 @@ else DUMPDIR ?= ~/lfs-sysd-commands endif +ifndef ARCH + ARCH = default +endif +ifneq ($(ARCH), default) + ifneq ($(ARCH), ml_32) + ifneq ($(ARCH), ml_x32) + ifneq ($(ARCH), ml_all) + $(error ARCH must be either 'default' (default if unset), 'ml_32', 'ml_x32' or 'ml_all'.) + endif + endif + endif +endif + book: validate profile-html @echo "Generating chunked XHTML files at $(BASEDIR)/ ..." $(Q)xsltproc --nonet \ @@ -129,6 +142,7 @@ validate: tmpdir version --xinclude \ --output $(RENDERTMP)/lfs-html2.xml \ --stringparam profile.revision $(REV) \ + --stringparam profile.arch $(ARCH) \ stylesheets/lfs-xsl/profile.xsl \ index.xml @@ -176,6 +190,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \ $(Q)xsltproc --nonet --xinclude \ --stringparam profile.revision $(REV) \ + --stringparam profile.arch $(ARCH) \ --output $(RENDERTMP)/sysv-md5sum.xml \ stylesheets/lfs-xsl/profile.xsl \ chapter03/chapter03.xml diff --git a/chapter01/askforhelp.xml b/chapter01/askforhelp.xml index 70b9b5e44..8a8ba39a4 100644 --- a/chapter01/askforhelp.xml +++ b/chapter01/askforhelp.xml @@ -38,9 +38,13 @@ <itemizedlist> <listitem> - <para>The version of the book being used (in this case - <phrase revision="sysv">&version;</phrase> - <phrase revision="systemd">&versiond;</phrase>)</para> + <para> + The version of the book being used (in this case + <phrase arch="default" revision="sysv">&version;</phrase> + <phrase arch="ml_32,ml_x32,ml_all" revision="sysv">&version;-multilib</phrase> + <phrase arch="default" revision="systemd">&versiond;</phrase> + <phrase arch="ml_32,ml_x32,ml_all" revision="systemd">&versiond;-multilib</phrase>) + </para> </listitem> <listitem> <para>The host distribution and version being used to create LFS</para> @@ -55,7 +59,7 @@ <para>The exact error message or symptom being received</para> </listitem> <listitem> - <para>Note whether you have deviated from the book at all </para> + <para>Note whether you have deviated from the book at all</para> </listitem> </itemizedlist> diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 2073f79bf..218b374af 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -11,8 +11,10 @@ <title>Changelog</title> <para>This is version - <phrase revision="sysv">&version;</phrase> - <phrase revision="systemd">&versiond;</phrase> + <phrase arch="default" revision="sysv">&version;</phrase> + <phrase arch="ml_32,ml_x32,ml_all" revision="sysv">&version;-multilib</phrase> + <phrase arch="default" revision="systemd">&versiond;</phrase> + <phrase arch="ml_32,ml_x32,ml_all" revision="systemd">&versiond;-multilib</phrase> of the Linux From Scratch book, dated &releasedate;. If this book is more than six months old, a newer and better version is probably already available. To find out, please check one of the diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml index e513bd92d..c125e1c5e 100644 --- a/chapter02/hostreqs.xml +++ b/chapter02/hostreqs.xml @@ -236,4 +236,24 @@ bash library-check.sh</userinput></screen> or all absent, but not only one or two present.</para> --> + <para arch="ml_32,ml_x32,ml_all"> + Building multilib support requires the kernel of the host system + to have 32-bit emulation support included. + </para> +<screen arch="ml_32,ml_x32,ml_all">Binary Emulations ---> + [*] IA32 Emulation + <M> IA32 a.out support + [*] x32 ABI for 64-bit mode +</screen> + + <para arch="ml_32,ml_x32,ml_all">The option 'IA32 a.out support' is + optional. In case your kernel does not have 'x32 ABI for 64-bit mode' + enabled but only 'IA32 Emulation', you can continue to build your + system but you have to leave out any sections showing instructions + for building x32 objects. If neither 'IA32 Emulation' nor + 'x32 ABI for 64-bit mode' is enabled, you will run in errors + latest when building <application>glibc</application> in Chapter 6, + so an upgrade of your host system kernel is required. + </para> + </sect1> diff --git a/chapter03/packages.xml b/chapter03/packages.xml index 191f7f921..2e18fb397 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -349,6 +349,15 @@ </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term>ISL (&isl-version;) - <token>&isl-size;</token>:</term> + <listitem> + <para>Home page: <ulink url="&isl-home;"/></para> + <para>Download: <ulink url="&isl-url;"/></para> + <para>MD5 sum: <literal>&isl-md5;</literal></para> + </listitem> + </varlistentry> + <varlistentry revision="systemd"> <term>Jinja2 (&jinja2-version;) - <token>&jinja2-size;</token>:</term> <listitem> diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml index 59fca9468..db04542da 100644 --- a/chapter04/addinguser.xml +++ b/chapter04/addinguser.xml @@ -84,6 +84,9 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen> case $(uname -m) in x86_64) chown -v lfs $LFS/lib64 ;; esac</userinput></screen> +<screen arch="ml_32" ><userinput>chown -v lfs $LFS/lib32</userinput></screen> +<screen arch="ml_x32" ><userinput>chown -v lfs $LFS/libx32</userinput></screen> +<screen arch="ml_all" ><userinput>chown -v lfs $LFS/{lib32,libx32}</userinput></screen> <para>If a separate working directory was created as suggested, give user <systemitem class="username">lfs</systemitem> ownership of this diff --git a/chapter04/creatingminlayout.xml b/chapter04/creatingminlayout.xml index 50c431324..df72e7b43 100644 --- a/chapter04/creatingminlayout.xml +++ b/chapter04/creatingminlayout.xml @@ -29,6 +29,13 @@ done case $(uname -m) in x86_64) mkdir -pv $LFS/lib64 ;; esac</userinput></screen> +<screen arch="ml_32"><userinput>mkdir -pv $LFS/usr/lib32 +ln -sv usr/lib32 $LFS/lib32</userinput></screen> +<screen arch="ml_x32"><userinput>mkdir -pv $LFS/usr/libx32 +ln -sv usr/libx32 $LFS/libx32</userinput></screen> +<screen arch="ml_all"><userinput>mkdir -pv $LFS/usr/lib{,x}32 +ln -sv usr/lib32 $LFS/lib32 +ln -sv usr/libx32 $LFS/libx32</userinput></screen> <note> <para> diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index 3b682b061..c1fe6b75b 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -37,7 +37,7 @@ EOF</userinput></screen> <filename>.bashrc</filename> file instead. Create the <filename>.bashrc</filename> file now:</para> -<screen><userinput>cat > ~/.bashrc << "EOF" +<screen arch="default"><userinput>cat > ~/.bashrc << "EOF" <literal>set +h umask 022 LFS=/mnt/lfs @@ -49,6 +49,19 @@ PATH=$LFS/tools/bin:$PATH CONFIG_SITE=$LFS/usr/share/config.site export LFS LC_ALL LFS_TGT PATH CONFIG_SITE</literal> EOF</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput>cat > ~/.bashrc << "EOF" +<literal>set +h +umask 022 +LFS=/mnt/lfs +LC_ALL=POSIX +LFS_TGT=x86_64-lfs-linux-gnu +LFS_TGT32=i686-lfs-linux-gnu +LFS_TGTX32=x86_64-lfs-linux-gnux32 +PATH=/usr/bin +if [ ! -L /bin ]; then PATH=/bin:$PATH; fi +PATH=$LFS/tools/bin:$PATH +export LFS LC_ALL LFS_TGT LFS_TGT32 LFS_TGTX32 PATH</literal> +EOF</userinput></screen> <variablelist> <title>The meaning of the settings in <filename>.bashrc</filename></title> diff --git a/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml index e17c2fc92..5d9e21fd7 100644 --- a/chapter05/binutils-pass1.xml +++ b/chapter05/binutils-pass1.xml @@ -70,11 +70,17 @@ cd build</userinput></screen> <para>Now prepare Binutils for compilation:</para> - <screen><userinput remap="configure">../configure --prefix=$LFS/tools \ + <screen arch="default"><userinput remap="configure">../configure --prefix=$LFS/tools \ --with-sysroot=$LFS \ --target=$LFS_TGT \ --disable-nls \ --disable-werror</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=$LFS/tools \ + --with-sysroot=$LFS \ + --target=$LFS_TGT \ + --disable-nls \ + --disable-werror \ + --enable-multilib</userinput></screen> <variablelist> <title>The meaning of the configure options:</title> @@ -123,6 +129,13 @@ cd build</userinput></screen> </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term><parameter>--enable-multilib</parameter></term> + <listitem> + <para>Enables multilib support.</para> + </listitem> + </varlistentry> + </variablelist> <para>Continue with compiling the package:</para> diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 0cd852ee6..f686e6ea5 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -60,18 +60,28 @@ mv -v mpfr-&mpfr-version; mpfr tar -xf ../gmp-&gmp-version;.tar.xz mv -v gmp-&gmp-version; gmp tar -xf ../mpc-&mpc-version;.tar.gz -mv -v mpc-&mpc-version; mpc</userinput></screen> +mv -v mpc-&mpc-version; mpc</userinput> +<userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz +mv -v isl-&isl-version; isl</userinput></screen> - <para>On x86_64 hosts, set the default directory name for + <para arch="default">On x86_64 hosts, set the default directory name for 64-bit libraries to <quote>lib</quote>:</para> -<screen><userinput remap="pre">case $(uname -m) in +<screen arch="default"><userinput remap="pre">case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac</userinput></screen> + <para arch="ml_32,ml_x32,ml_all">Change the default directory name for + libraries:</para> + +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \ + -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ + -i.orig gcc/config/i386/t-linux64 +</userinput></screen> + <para>The GCC documentation recommends building GCC in a dedicated build directory:</para> @@ -80,7 +90,7 @@ cd build</userinput></screen> <para>Prepare GCC for compilation:</para> -<screen><userinput remap="configure">../configure \ +<screen arch="default"><userinput remap="configure">../configure \ --target=$LFS_TGT \ --prefix=$LFS/tools \ --with-glibc-version=2.11 \ @@ -100,6 +110,31 @@ cd build</userinput></screen> --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure" + arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure" + arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure" + arch="ml_all">mlist=m64,m32,mx32</userinput> +<userinput remap="configure">../configure \ + --target=$LFS_TGT \ + --prefix=$LFS/tools \ + --with-glibc-version=2.11 \ + --with-sysroot=$LFS \ + --with-newlib \ + --without-headers \ + --enable-initfini-array \ + --disable-nls \ + --disable-shared \ + --enable-multilib --with-multilib-list=$mlist \ + --disable-decimal-float \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++</userinput></screen> + <variablelist> <title>The meaning of the configure options:</title> @@ -149,13 +184,20 @@ cd build</userinput></screen> </listitem> </varlistentry> - <varlistentry> + <varlistentry arch="default"> <term><parameter>--disable-multilib</parameter></term> <listitem> <para>On x86_64, LFS does not support a multilib configuration. This switch is harmless for x86.</para> </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term><parameter>--enable-multilib --with-multilib-list=...</parameter></term> + <listitem> + <para>LFS canbe used to support multilib. Which they are is + specified in the multilib list.</para> + </listitem> + </varlistentry> <varlistentry> <term><parameter>--disable-decimal-float, --disable-threads, diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 37a222bd1..07cda22df 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> <para>Some of the Glibc programs use the non-FHS compliant <filename class="directory">/var/db</filename> directory to store their @@ -76,13 +79,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> @@ -195,7 +206,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 shown as above or there was no output at all, @@ -223,6 +234,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(){}' > 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(){}' > 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/> diff --git a/chapter05/libstdc++.xml b/chapter05/libstdc++.xml index 68da1f7c2..9820a3d02 100644 --- a/chapter05/libstdc++.xml +++ b/chapter05/libstdc++.xml @@ -81,6 +81,16 @@ cd build</userinput></screen> </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term><parameter>--disable-multilib</parameter></term> + <listitem> + <para>Even when building the multilib version, this switch is + given. This is because the additionally built libraries are + not required in this stage and some disk space and compile + time can be saved.</para> + </listitem> + </varlistentry> + <varlistentry> <term><parameter>--disable-libstdcxx-pch</parameter></term> <listitem> diff --git a/chapter06/binutils-pass2.xml b/chapter06/binutils-pass2.xml index 182e06df0..187eb7297 100644 --- a/chapter06/binutils-pass2.xml +++ b/chapter06/binutils-pass2.xml @@ -50,7 +50,7 @@ cd build</userinput></screen> <para>Prepare Binutils for compilation:</para> -<screen><userinput remap="configure">../configure \ +<screen arch="default"><userinput remap="configure">../configure \ --prefix=/usr \ --build=$(../config.guess) \ --host=$LFS_TGT \ @@ -58,6 +58,15 @@ cd build</userinput></screen> --enable-shared \ --disable-werror \ --enable-64-bit-bfd</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure \ + --prefix=/usr \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --disable-nls \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd \ + --enable-multilib</userinput></screen> <variablelist> <title>The meaning of the new configure options:</title> @@ -79,6 +88,13 @@ cd build</userinput></screen> </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term><parameter>--enable-multilib</parameter></term> + <listitem> + <para>Enables multilib support in bintutils.</para> + </listitem> + </varlistentry> + </variablelist> <para>Compile the package:</para> diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml index bf3007848..66770a4d1 100644 --- a/chapter06/gcc-pass2.xml +++ b/chapter06/gcc-pass2.xml @@ -52,20 +52,27 @@ mv -v mpfr-&mpfr-version; mpfr tar -xf ../gmp-&gmp-version;.tar.xz mv -v gmp-&gmp-version; gmp tar -xf ../mpc-&mpc-version;.tar.gz -mv -v mpc-&mpc-version; mpc</userinput></screen> +mv -v mpc-&mpc-version; mpc</userinput> +<userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz +mv -v isl-&isl-version; isl</userinput></screen> - <para>If building on x86_64, change the default directory name for 64-bit + + <para arch="default">If building on x86_64, change the default directory name for 64-bit libraries to <quote>lib</quote>:</para> -<screen><userinput remap="pre">case $(uname -m) in +<screen arch="default"><userinput remap="pre">case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 ;; esac</userinput></screen> -<!-- - <para>Fix an issue with GCC-10.1 when building with a cross - compiler:</para> + <para arch="ml_32,ml_x32,ml_all">Change the default directory name for + libraries:</para> + +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \ + -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ + -i.orig gcc/config/i386/t-linux64</userinput></screen> +<!-- <screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen> --> <para>Create a separate build directory again:</para> @@ -84,7 +91,7 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></s <para>Now prepare GCC for compilation:</para> -<screen><userinput remap="configure">../configure \ +<screen arch="default"><userinput remap="configure">../configure \ --build=$(../config.guess) \ --host=$LFS_TGT \ --prefix=/usr \ @@ -101,6 +108,27 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></s --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure" + arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure" + arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure" + arch="ml_all">mlist=m64,m32,mx32</userinput> +<userinput remap="configure">../configure \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --prefix=/usr \ + CC_FOR_TARGET=$LFS_TGT-gcc \ + --with-build-sysroot=$LFS \ + --enable-initfini-array \ + --disable-nls \ + --enable-multilib --with-multilib-list=$mlist \ + --disable-decimal-float \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++</userinput></screen> <variablelist> <title>The meaning of the new configure options:</title><!-- WIP --> diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index 79b38e2b4..2d0babc31 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -150,6 +150,86 @@ echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + <sect2 arch="ml_32,ml_all"> + <title>Building Ncurses - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Ncurses for compilation:</para> + +<screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \ +CXX="$LFS_TGT-g++ -m32" \ +./configure --prefix=/usr \ + --host=$LFS_TGT32 \ + --build=$(./config.guess) \ + --libdir=/usr/lib32 \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-ada \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=/usr/lib32/pkgconfig</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 TIC_PATH=$(pwd)/build/progs/tic install +ln -s libncursesw.so DESTDIR/usr/lib32/libcursesw.so +cp -Rv DESTDIR/usr/lib32/* $LFS/usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + <sect2 arch="ml_x32,ml_all"> + <title>Building Ncurses - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Ncurses for compilation:</para> + +<screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \ +CXX="$LFS_TGT-g++ -mx32" \ +./configure --prefix=/usr \ + --host=$LFS_TGTX32 \ + --build=$(./config.guess) \ + --libdir=/usr/libx32 \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-ada \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=/usr/libx32/pkgconfig</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 TIC_PATH=$(pwd)/build/progs/tic install +ln -s libncursesw.so DESTDIR/usr/libx32/libcursesw.so +cp -Rv DESTDIR/usr/libx32/* $LFS/usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 role="content"> <title/> diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml index b412bb278..2bc57d304 100644 --- a/chapter07/changingowner.xml +++ b/chapter07/changingowner.xml @@ -38,4 +38,9 @@ case $(uname -m) in x86_64) chown -R root:root $LFS/lib64 ;; esac</userinput></screen> + <para arch="ml_32,ml_x32,ml_all">Some more directories exists for + multilib support. Change their ownership, too:</para> +<screen arch="ml_32,ml_x32,ml_all"><userinput arch="ml_32,ml_all">chown -R root:root $LFS/lib32</userinput> +<userinput arch="ml_x32,ml_all">chown -R root:root $LFS/libx32</userinput></screen> + </sect1> diff --git a/chapter07/cleanup.xml b/chapter07/cleanup.xml index 36af2cfaa..243e8834e 100644 --- a/chapter07/cleanup.xml +++ b/chapter07/cleanup.xml @@ -23,7 +23,10 @@ shared libraries, specially when using non-autotools build systems. While still in chroot, remove those files now:</para> -<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen> +<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput><userinput arch="ml_32"> +find /usr/lib32 -name \*.la -delete</userinput><userinput arch="ml_x32"> +find /usr/libx32 -name \*.la -delete</userinput><userinput arch="ml_all"> +find /usr/lib{,x}32 -name \*.la -delete</userinput></screen> <para> The current system size is now about 3 GB, however diff --git a/chapter07/creatingdirs.xml b/chapter07/creatingdirs.xml index a1dafc1ee..55f95892d 100644 --- a/chapter07/creatingdirs.xml +++ b/chapter07/creatingdirs.xml @@ -41,6 +41,9 @@ ln -sfv /run/lock /var/lock install -dv -m 0750 /root install -dv -m 1777 /tmp /var/tmp</userinput></screen> + <para arch="ml_32,ml_x32,ml_all">Required directories for multilib + support has already been created while previous installation steps.</para> + <para>Directories are, by default, created with permission mode 755, but this is not desirable for all directories. In the commands above, two changes are made—one to the home directory of user <systemitem diff --git a/chapter07/libstdc++-pass2.xml b/chapter07/libstdc++-pass2.xml index 35b5a8baf..328e60a07 100644 --- a/chapter07/libstdc++-pass2.xml +++ b/chapter07/libstdc++-pass2.xml @@ -62,13 +62,20 @@ cd build</userinput></screen> <para>Prepare libstdc++ for compilation:</para> -<screen><userinput remap="configure">../libstdc++-v3/configure \ +<screen arch="default"><userinput remap="configure">../libstdc++-v3/configure \ CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ --prefix=/usr \ --disable-multilib \ --disable-nls \ --host=$(uname -m)-lfs-linux-gnu \ --disable-libstdcxx-pch</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../libstdc++-v3/configure \ + CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ + --prefix=/usr \ + --enable-multilib \ + --disable-nls \ + --host=$(uname -m)-lfs-linux-gnu \ + --disable-libstdcxx-pch</userinput></screen> <variablelist> <title>The meaning of the configure options:</title> @@ -98,6 +105,16 @@ cd build</userinput></screen> </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term><parameter>--enable-multilib</parameter></term> + <listitem> + <para>This switch is set by default but it is added here + explicitly for documentary purpose. The libstdc++ libraries + will be built for every arch (m64, m32, mx32) which are + made available in <xref linkend="ch-tools-gcc-pass1"/>.</para> + </listitem> + </varlistentry> + </variablelist> <para>Compile libstdc++ by running:</para> diff --git a/chapter07/util-linux.xml b/chapter07/util-linux.xml index 8295d0d8e..63d48caff 100644 --- a/chapter07/util-linux.xml +++ b/chapter07/util-linux.xml @@ -126,6 +126,86 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Util-linux - 32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Util-linux for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --libdir=/usr/lib32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Util-linux - x32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Util-linux for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --libdir=/usr/libx32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 role="content"> <title/> diff --git a/chapter08/acl.xml b/chapter08/acl.xml index 48bf73a75..654a250e3 100644 --- a/chapter08/acl.xml +++ b/chapter08/acl.xml @@ -64,6 +64,70 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Acl - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Xz for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=/usr/lib32 \ + --libexecdir=/usr/lib32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Acl - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Xz for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=/usr/libx32 \ + --libexecdir=/usr/libx32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-acl" role="content"> <title>Contents of Acl</title> diff --git a/chapter08/attr.xml b/chapter08/attr.xml index 122781f27..fdb538df8 100644 --- a/chapter08/attr.xml +++ b/chapter08/attr.xml @@ -64,6 +64,68 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Attr - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Attr for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=/usr/lib32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Attr - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Attr for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=/usr/libx32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-attr" role="content"> <title>Contents of Attr</title> diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml index c01ba44bd..b308ec0cd 100644 --- a/chapter08/binutils.xml +++ b/chapter08/binutils.xml @@ -82,7 +82,7 @@ cd build</userinput></screen> <para>Prepare Binutils for compilation:</para> -<screen><userinput remap="configure">../configure --prefix=/usr \ +<screen arch="default"><userinput remap="configure">../configure --prefix=/usr \ --enable-gold \ --enable-ld=default \ --enable-plugins \ @@ -90,6 +90,16 @@ cd build</userinput></screen> --disable-werror \ --enable-64-bit-bfd \ --with-system-zlib</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr \ + --enable-gold \ + --enable-ld=default \ + --enable-plugins \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd \ + --with-system-zlib \ + --enable-multilib</userinput></screen> + <variablelist> <title>The meaning of the configure parameters:</title> @@ -124,6 +134,13 @@ cd build</userinput></screen> </listitem> </varlistentry> + <varlistentry arch="ml_32,ml_x32,ml_all"> + <term><parameter>--enable-multilib</parameter></term> + <listitem> + <para>Enables multilib support in bintutils.</para> + </listitem> + </varlistentry> + <varlistentry> <term><parameter>--with-system-zlib</parameter></term> <listitem> diff --git a/chapter08/bzip2.xml b/chapter08/bzip2.xml index e57fe61c4..4418989da 100644 --- a/chapter08/bzip2.xml +++ b/chapter08/bzip2.xml @@ -103,6 +103,60 @@ done</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Bzip2 - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make clean</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">sed -e "s/^CC=.*/CC=gcc -m32/" -i Makefile{,-libbz2_so} +make -f Makefile-libbz2_so +make libbz2.a</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">install -Dm755 libbz2.so.1.0.8 /usr/lib32/libbz2.so.1.0.8 +ln -sf libbz2.so.1.0.8 /usr/lib32/libbz2.so +ln -sf libbz2.so.1.0.8 /usr/lib32/libbz2.so.1 +ln -sf libbz2.so.1.0.8 /usr/lib32/libbz2.so.1.0 +install -Dm644 libbz2.a /usr/lib32/libbz2.a</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Bzip2 - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make clean</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">sed -e "s/^CC=.*/CC=gcc -mx32/" -i Makefile{,-libbz2_so} +make -f Makefile-libbz2_so +make libbz2.a</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">install -Dm755 libbz2.so.1.0.8 /usr/libx32/libbz2.so.1.0.8 +ln -sf libbz2.so.1.0.8 /usr/libx32/libbz2.so +ln -sf libbz2.so.1.0.8 /usr/libx32/libbz2.so.1 +ln -sf libbz2.so.1.0.8 /usr/libx32/libbz2.so.1.0 +install -Dm644 libbz2.a /usr/libx32/libbz2.a</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-bzip2" role="content"> <title>Contents of Bzip2</title> diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index e9cb2b2ce..077503789 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -34,6 +34,7 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gmp.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpfr.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpc.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="isl.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="attr.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="acl.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libcap.xml"/> diff --git a/chapter08/eudev.xml b/chapter08/eudev.xml index aa86f5150..e1b82dd48 100644 --- a/chapter08/eudev.xml +++ b/chapter08/eudev.xml @@ -84,6 +84,76 @@ make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Eudev - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Eudev for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" \ +./configure --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --bindir=/usr/sbin \ + --libdir=/usr/lib32 \ + --sysconfdir=/etc \ + --disable-manpages \ + --disable-static \ + --config-cache</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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Eudev - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Eudev for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" \ +./configure --host=x86_64-lfs-linux-gnux32 \ + --prefix=/usr \ + --bindir=/usr/sbin \ + --libdir=/usr/libx32 \ + --sysconfdir=/etc \ + --disable-manpages \ + --disable-static \ + --config-cache</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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="conf-eudev" role="configuration"> <title>Configuring Eudev</title> diff --git a/chapter08/expat.xml b/chapter08/expat.xml index f4f03aad5..f1177c251 100644 --- a/chapter08/expat.xml +++ b/chapter08/expat.xml @@ -65,6 +65,70 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Expat - 32bit</title> + + <para>Clean previous build but keep precompiled doc because it + cannot be rebuilt in this stage of the system:</para> + +<screen><userinput remap="pre">sed -e "/^am__append_1/ s/doc//" -i Makefile +make clean</userinput></screen> + + <para>Prepare Expat for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Expat - x32bit</title> + + <para>Clean previous build but keep precompiled doc because it + cannot be rebuilt in this stage of the system:</para> + +<screen><userinput remap="pre">sed -e "/^am__append_1/ s/doc//" -i Makefile +make clean</userinput></screen> + + <para>Prepare Expat for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-expat" role="content"> <title>Contents of Expat</title> diff --git a/chapter08/file.xml b/chapter08/file.xml index eb9f41a2b..1b1a1c0a8 100644 --- a/chapter08/file.xml +++ b/chapter08/file.xml @@ -59,6 +59,65 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of File - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare File for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of File - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare File for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --host=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">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> <sect2 id="contents-file" role="content"> <title>Contents of File</title> diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index bbe83a50d..973dc9f34 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -52,13 +52,20 @@ <para>If building on x86_64, change the default directory name for 64-bit libraries to <quote>lib</quote>:</para> -<screen><userinput remap="pre">case $(uname -m) in +<screen arch="default"><userinput remap="pre">case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac</userinput></screen> + <para arch="ml_32,ml_x32,ml_all">Change the default directory name for 64-bit + libraries to <quote>lib</quote>:</para> + +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \ + -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ + -i.orig gcc/config/i386/t-linux64</userinput></screen> + <para>The GCC documentation recommends building GCC in a dedicated build directory:</para> <screen><userinput remap="pre">mkdir -v build @@ -66,12 +73,23 @@ cd build</userinput></screen> <para>Prepare GCC for compilation:</para> -<screen><userinput remap="configure">../configure --prefix=/usr \ +<screen arch="default"><userinput remap="configure">../configure --prefix=/usr \ LD=ld \ --enable-languages=c,c++ \ --disable-multilib \ --disable-bootstrap \ --with-system-zlib</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure" + arch="ml_32" >mlist=m64,m32</userinput><userinput remap="configure" + arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure" + arch="ml_all">mlist=m64,m32,mx32</userinput> +<userinput remap="configure">../configure --prefix=/usr \ + LD=ld \ + --enable-languages=c,c++ \ + --enable-multilib \ + --with-multilib-list=$mlist \ + --disable-bootstrap \ + --with-system-zlib</userinput></screen> <para>Note that for other programming languages there are some prerequisites that are not yet available. See the @@ -269,10 +287,11 @@ SEARCH_DIR("/usr/local/lib") SEARCH_DIR("/lib") SEARCH_DIR("/usr/lib");</computeroutput></screen> - <para>A 32-bit system may see a few different directories. For example, here + <para arch="default">A 32-bit system may see a few different directories. For example, here is the output from an i686 machine:</para> -<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32") +<!-- not using entities here as the dir names has nothing to do with multilib --> +<screen arch="default"><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32") SEARCH_DIR("/usr/local/lib32") SEARCH_DIR("/lib32") SEARCH_DIR("/usr/lib32") diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 968b398e0..3a1fbda23 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -69,12 +69,19 @@ cd build</userinput></screen> <para>Prepare Glibc for compilation:</para> -<screen><userinput remap="configure">../configure --prefix=/usr \ +<screen arch="default"><userinput remap="configure">../configure --prefix=/usr \ --disable-werror \ --enable-kernel=&min-kernel; \ --enable-stack-protector=strong \ --with-headers=/usr/include \ libc_cv_slibdir=/usr/lib</userinput></screen> +<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr \ + --disable-werror \ + --enable-kernel=&min-kernel; \ + --enable-stack-protector=strong \ + --with-headers=/usr/include \ + --enable-multi-arch \ + libc_cv_slibdir=/usr/lib</userinput></screen> <variablelist> <title>The meaning of the configure options:</title> @@ -469,6 +476,156 @@ mkdir -pv /etc/ld.so.conf.d</userinput></screen> </sect3> </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">rm -rf ./* +find .. -name "*.a" -delete</userinput></screen> + + <para>Configure Glibc for m32 with the following commands:</para> + +<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \ +../configure \ + --prefix=/usr \ + --host=i686-pc-linux-gnu \ + --build=$(../scripts/config.guess) \ + --enable-kernel=&min-kernel; \ + --with-headers=/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/* /usr/lib32/ +install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ + /usr/include/gnu/</userinput></screen> +<!-- no longer required as they are created in chap5 +ln -svf ../lib32/ld-linux.so.2 /lib/ld-linux.so.2 +--> + + <para>Add the library name to the dynamic loader config:</para> + +<screen role="install"><userinput>echo "/usr/lib32" >> /etc/ld.so.conf</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(){}' > dummy.c +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">rm -rf ./* +find .. -name "*.a" -delete</userinput></screen> + + <para>Configure Glibc for mx32 with the following commands:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \ +../configure \ + --prefix=/usr \ + --host=x86_64-pc-linux-gnux32 \ + --build=$(../scripts/config.guess) \ + --enable-kernel=&min-kernel; \ + --with-headers=/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/* /usr/libx32/ +install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \ + /usr/include/gnu/</userinput></screen> +<!-- no longer required as they are created in chap5 +ln -svf ../libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2 +--> + <para>Add the library name to the dynamic loader config:</para> + +<screen role="install"><userinput>echo "/usr/libx32" >> /etc/ld.so.conf</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(){}' > dummy.c +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 id="contents-glibc" role="content"> <title>Contents of Glibc</title> diff --git a/chapter08/gmp.xml b/chapter08/gmp.xml index 2419e2d02..94f842918 100644 --- a/chapter08/gmp.xml +++ b/chapter08/gmp.xml @@ -120,6 +120,138 @@ make install-html</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of GMP - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Generic libraries can be created by running + the following:</para> + +<screen role="nodump"><userinput remap="pre">cp -v configfsf.guess config.guess +cp -v configfsf.sub config.sub</userinput></screen> + + <para>Prepare GMP for compilation:</para> + +<screen><userinput remap="configure">ABI="32" \ +CFLAGS="-m32 -O2 -pedantic -fomit-frame-pointer -mtune=generic -march=i686" \ +CXXFLAGS="$CFLAGS" \ +PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \ +./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --disable-static \ + --enable-cxx \ + --libdir=/usr/lib32 \ + --includedir=/usr/include/m32/gmp</userinput></screen> + + <variablelist> + <title>The meaning of the new configure options:</title> + + <varlistentry> + <term><parameter>--includedir=/usr/include/m32/gmp</parameter></term> + <listitem> + <para>Some definitions in gmp.h differs for each arch but + has same name. Therefore, the headers must be separated from + each other.</para> + </listitem> + </varlistentry> + + </variablelist> + + <para>Compile the package:</para> + +<screen><userinput remap="make">sed -i 's/$(exec_prefix)\/include/$\(includedir\)/' Makefile +make</userinput></screen> + + <important> + <para>The test suite for GMP in this section is considered critical. + Do not skip it under any circumstances.</para> + </important> + + <para>Test the results:</para> + +<screen><userinput remap="test">make check 2>&1 | tee gmp-check-log</userinput></screen> + + <para>Ensure that all 197 tests in the test suite passed. + Check the results by issuing the following command:</para> + +<screen><userinput remap="test">awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR/usr/include/m32/* /usr/include/m32/ +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of GMP - x32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Generic libraries can be created by running + the following:</para> + +<screen role="nodump"><userinput remap="pre">cp -v configfsf.guess config.guess +cp -v configfsf.sub config.sub</userinput></screen> + + <para>Prepare GMP for compilation:</para> + +<screen><userinput remap="configure">ABI="x32" \ +CFLAGS="-mx32 -O2 -pedantic -fomit-frame-pointer -mtune=generic -march=x86-64" \ +CXXFLAGS="$CFLAGS" \ +PKG_CONFIG_PATH="/usr/libx32/pkgconfig" \ +./configure \ + --host=x86_64-pc-linux-gnux32 \ + --prefix=/usr \ + --disable-static \ + --enable-cxx \ + --libdir=/usr/libx32 \ + --includedir=/usr/include/mx32/gmp</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">sed -i 's/$(exec_prefix)\/include/$\(includedir\)/' Makefile +make</userinput></screen> + + <important> + <para>The test suite for GMP in this section is considered critical. + Do not skip it under any circumstances.</para> + </important> + + <para>Test the results:</para> + +<screen><userinput remap="test">make check 2>&1 | tee gmp-check-log</userinput></screen> + + <para>Ensure that all 197 tests in the test suite passed. + Check the results by issuing the following command:</para> + +<screen><userinput remap="test">awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR/usr/include/mx32/* /usr/include/mx32/ +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-gmp" role="content"> <title>Contents of GMP</title> diff --git a/chapter08/isl.xml b/chapter08/isl.xml new file mode 100644 index 000000000..7d8c8cc45 --- /dev/null +++ b/chapter08/isl.xml @@ -0,0 +1,113 @@ +<?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 id="ch-system-isl" role="wrap" arch="ml_32,ml_x32,ml_all"> + <?dbhtml filename="isl.html"?> + + <sect1info condition="script"> + <productname>isl</productname> + <productnumber>&isl-version;</productnumber> + <address>&isl-url;</address> + </sect1info> + + <title>ISL-&isl-version;</title> + + <indexterm zone="ch-system-isl"> + <primary sortas="a-ISL">ISL</primary> + </indexterm> + + <sect2 role="package"> + <title/> + + <para>ISL is a thread-safe C library for manipulating sets and relations + of integer points bounded by affine constraints.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&isl-fin-sbu;</seg> + <seg>&isl-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of ISL</title> + + <para>Prepare ISL for compilation:</para> + +<screen><userinput remap="configure">./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/isl-&isl-version;</userinput></screen> + + <variablelist> + <title>The meaning of the new configure options:</title> + + <varlistentry> + <term><parameter>--docdir=/usr/share/doc/isl-&isl-version;</parameter></term> + <listitem> + <para>This variable specifies the correct place for the + documentation.</para> + </listitem> + </varlistentry> + + </variablelist> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <para>Install the package and its documentation:</para> + +<screen><userinput remap="install">make install +install -vd /usr/share/doc/isl-&isl-version; +install -m644 doc/{CodingStyle,manual.pdf,SubmittingPatches,user.pod} \ + /usr/share/doc/isl-&isl-version;</userinput></screen> + + <para>Finally, move a misplaced file:</para> + +<screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib +mv -v /usr/lib/libisl*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen> + + </sect2> + + <sect2 id="contents-isl" role="content"> + <title>Contents of ISL</title> + + <segmentedlist> + <segtitle>Installed Libraries</segtitle> + <segtitle>Installed directory</segtitle> + + <seglistitem> + <seg>libisl.so</seg> + <seg>/usr/share/doc/isl-&isl-version;</seg> + </seglistitem> + </segmentedlist> + + <variablelist> + <bridgehead renderas="sect3">Short Descriptions</bridgehead> + <?dbfo list-presentation="list"?> + <?dbhtml list-presentation="table"?> + + <varlistentry id="libisl"> + <term><filename class="libraryfile">libisl</filename></term> + <listitem> + <para>Contains integer set manipulation functions</para> + <indexterm zone="ch-system-isl libisl"> + <primary sortas="c-libisl">libisl</primary> + </indexterm> + </listitem> + </varlistentry> + </variablelist> + + </sect2> + +</sect1> + diff --git a/chapter08/kmod.xml b/chapter08/kmod.xml index f26c776a9..dd7e8afc2 100644 --- a/chapter08/kmod.xml +++ b/chapter08/kmod.xml @@ -83,6 +83,78 @@ ln -sfv kmod /usr/bin/lsmod</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Kmod - 32bit</title> + + <para>Clean previous build but keep man pages as they cannot + be recreated since xsltproc isn't installed yet:</para> + +<screen><userinput remap="pre">sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile +make clean</userinput></screen> + + <para>Prepare Kmod for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --sysconfdir=/etc \ + --with-xz \ + --with-zlib \ + --with-rootlibdir=/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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Kmod - x32bit</title> + + <para>Clean previous build but keep man pages as they cannot + be recreated since xsltproc isn't installed yet:</para> + +<screen><userinput remap="pre">sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile +make clean</userinput></screen> + + <para>Prepare Kmod for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --host=x86_64-pc-linux-gnux32 \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --sysconfdir=/etc \ + --with-xz \ + --with-zlib \ + --with-rootlibdir=/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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-kmod" role="content"> <title>Contents of Kmod</title> diff --git a/chapter08/libcap.xml b/chapter08/libcap.xml index d8fc15175..15411e94e 100644 --- a/chapter08/libcap.xml +++ b/chapter08/libcap.xml @@ -79,6 +79,56 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Libcap - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make CC="gcc -m32 -march=i686"</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make CC="gcc -m32 -march=i686" lib=lib32 prefix=$PWD/DESTDIR/usr -C libcap install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +sed -e "s|^libdir=.*|libdir=/usr/lib32|" -i /usr/lib32/pkgconfig/lib{cap,psx}.pc +chmod -v 755 /usr/lib32/libcap.so.&libcap-version; +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Libcap - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make CC="gcc -mx32 -march=x86-64"</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make CC="gcc -mx32 -march=x86-64" lib=libx32 prefix=$PWD/DESTDIR/usr -C libcap install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +sed -e "s|^libdir=.*|libdir=/usr/libx32|" -i /usr/libx32/pkgconfig/lib{cap,psx}.pc +chmod -v 755 /usr/libx32/libcap.so.&libcap-version; +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-libcap" role="content"> <title>Contents of Libcap</title> diff --git a/chapter08/libelf.xml b/chapter08/libelf.xml index 3465531a1..971aa458a 100644 --- a/chapter08/libelf.xml +++ b/chapter08/libelf.xml @@ -68,6 +68,72 @@ rm /usr/lib/libelf.a</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Libelf - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Libtool for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --disable-debuginfod \ + --enable-libdebuginfod=dummy</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 -C libelf install +install -vDm644 config/libelf.pc DESTDIR/usr/lib32/pkgconfig/libelf.pc +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Libelf - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Libtool for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --host=x86_64-pc-linux-gnux32 \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --disable-debuginfod \ + --enable-libdebuginfod=dummy</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 -C libelf install +install -vDm644 config/libelf.pc DESTDIR/usr/libx32/pkgconfig/libelf.pc +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-elfutils" role="content"> <title>Contents of Libelf</title> diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml index 1c93a7df4..3d72ea74c 100644 --- a/chapter08/libffi.xml +++ b/chapter08/libffi.xml @@ -103,6 +103,80 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Libffi - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Libffi for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" ./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --disable-static \ + --with-gcc-arch=i686 \ + --disable-exec-static-tramp</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <para>To test the results, issue:</para> + +<screen><userinput remap="test">make check</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Libffi - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Libffi for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" ./configure \ + --host=x86_64-unknown-linux-gnux32 \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --disable-static \ + --with-gcc-arch=x86_64 \ + --disable-exec-static-tramp</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <para>To test the results, issue:</para> + +<screen><userinput remap="test">make check</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-libffi" role="content"> <title>Contents of Libffi</title> @@ -133,4 +207,3 @@ </sect2> </sect1> - diff --git a/chapter08/libtool.xml b/chapter08/libtool.xml index 711adac05..e50d419a0 100644 --- a/chapter08/libtool.xml +++ b/chapter08/libtool.xml @@ -77,6 +77,65 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Libtool - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Libtool for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --libdir=/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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Libtool - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Libtool for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --host=x86_64-pc-linux-gnux32 \ + --prefix=/usr \ + --libdir=/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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> <sect2 id="contents-libtool" role="content"> <title>Contents of Libtool</title> diff --git a/chapter08/ncurses.xml b/chapter08/ncurses.xml index 3fbca0c3c..801b061e3 100644 --- a/chapter08/ncurses.xml +++ b/chapter08/ncurses.xml @@ -150,6 +150,96 @@ cp -av lib/lib*.so.5* /usr/lib</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + <sect2 arch="ml_32,ml_all"> + <title>Building Ncurses - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Ncurses for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \ +./configure --prefix=/usr \ + --host=i686-pc-linux-gnu \ + --libdir=/usr/lib32 \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=/usr/lib32/pkgconfig</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 +mkdir -p DESTDIR/usr/lib32/pkgconfig +for lib in ncurses form panel menu ; do + rm -vf DESTDIR/usr/lib32/lib${lib}.so + echo "INPUT(-l${lib}w)" > DESTDIR/usr/lib32/lib${lib}.so + ln -svf ${lib}w.pc DESTDIR/usr/lib32/pkgconfig/$lib.pc +done +rm -vf DESTDIR/usr/lib32/libcursesw.so +echo "INPUT(-lncursesw)" > DESTDIR/usr/lib32/libcursesw.so +ln -sfv libncurses.so DESTDIR/usr/lib32/libcurses.so +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + <sect2 arch="ml_x32,ml_all"> + <title>Building Ncurses - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Ncurses for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \ +./configure --prefix=/usr \ + --host=x86_64-pc-linux-gnux32 \ + --libdir=/usr/libx32 \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=/usr/libx32/pkgconfig</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 +mkdir -p DESTDIR/usr/libx32/pkgconfig +for lib in ncurses form panel menu ; do + rm -vf DESTDIR/usr/libx32/lib${lib}.so + echo "INPUT(-l${lib}w)" > DESTDIR/usr/libx32/lib${lib}.so + ln -svf ${lib}w.pc DESTDIR/usr/libx32/pkgconfig/$lib.pc +done +rm -vf DESTDIR/usr/libx32/libcursesw.so +echo "INPUT(-lncursesw)" > DESTDIR/usr/libx32/libcursesw.so +ln -sfv libncurses.so DESTDIR/usr/libx32/libcurses.so +cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-ncurses" role="content"> <title>Contents of Ncurses</title> diff --git a/chapter08/openssl.xml b/chapter08/openssl.xml index d1690efc6..786863b05 100644 --- a/chapter08/openssl.xml +++ b/chapter08/openssl.xml @@ -98,6 +98,76 @@ make MANSUFFIX=ssl install</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of OpenSSL - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare OpenSSL for compilation:</para> + +<screen><userinput remap="configure">MACHINE="i686" \ +CC="gcc -m32 -march=i686" \ +CXX="g++ -m32 -march=i686" \ + ./config \ + --prefix=/usr \ + --openssldir=/etc/ssl \ + --libdir=lib32 \ + shared \ + zlib-dynamic</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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of OpenSSL - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare OpenSSL for compilation:</para> + +<screen><userinput remap="configure">MACHINE="x86_64" \ +CC="gcc -mx32" \ +CXX="g++ -mx32" \ + ./config \ + --prefix=/usr \ + --openssldir=/etc/ssl \ + --libdir=libx32 \ + shared \ + zlib-dynamic</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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-openssl" role="content"> <title>Contents of OpenSSL</title> diff --git a/chapter08/readline.xml b/chapter08/readline.xml index 72608ac94..dca718219 100644 --- a/chapter08/readline.xml +++ b/chapter08/readline.xml @@ -100,6 +100,68 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install</userinput></screen> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Readline - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Readline for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --disable-static</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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Readline - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Readline for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --host=x86_64-pc-linux-gnux32 \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --disable-static</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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-readline" role="content"> <title>Contents of Readline</title> diff --git a/chapter08/revisedchroot.xml b/chapter08/revisedchroot.xml index 0c16ae622..533795f70 100644 --- a/chapter08/revisedchroot.xml +++ b/chapter08/revisedchroot.xml @@ -43,7 +43,9 @@ chroot "$LFS" /usr/bin/env -i \ shared libraries, specially when using also non-autotools build systems. To remove them, run:</para> -<screen><userinput>find /usr/lib /usr/libexec -name \*.la -delete</userinput></screen> +<screen><userinput>find /usr/lib /usr/libexec -name \*.la -delete</userinput><userinput arch="ml_32,ml_all"> +find /usr/lib32 -name \*.la -delete</userinput><userinput arch="ml_x32,ml_all"> +find /usr/libx32 -name \*.la -delete</userinput></screen> <para>For more information about libtool archive files, see the <ulink url="&blfs-book;/introduction/la-files.html">BLFS section "About Libtool diff --git a/chapter08/stripping.xml b/chapter08/stripping.xml index 6841cd830..da029346d 100644 --- a/chapter08/stripping.xml +++ b/chapter08/stripping.xml @@ -56,7 +56,6 @@ libatomic.so.&libatomic-version;" cd /usr/lib - for LIB in $save_usrlib; do objcopy --only-keep-debug $LIB $LIB.dbg cp $LIB /tmp/$LIB @@ -64,7 +63,27 @@ for LIB in $save_usrlib; do objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB install -vm755 /tmp/$LIB /usr/lib rm /tmp/$LIB -done +done</userinput> +<userinput arch="ml_32,ml_all"> +cd /usr/lib32 +for LIB in $save_usrlib; do + objcopy --only-keep-debug $LIB $LIB.dbg + cp $LIB /tmp/$LIB + strip --strip-unneeded /tmp/$LIB + objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB + install -vm755 /tmp/$LIB /usr/lib32 + rm /tmp/$LIB +done</userinput> +<userinput arch="ml_x32,ml_all"> +cd /usr/libx32 +for LIB in $save_usrlib; do + objcopy --only-keep-debug $LIB $LIB.dbg + cp $LIB /tmp/$LIB + strip --strip-unneeded /tmp/$LIB + objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB + install -vm755 /tmp/$LIB /usr/libx32 + rm /tmp/$LIB +done</userinput><userinput> online_usrbin="bash find strip" online_usrlib="libbfd-&binutils-version;.so @@ -87,7 +106,19 @@ for LIB in $online_usrlib; do strip --strip-unneeded /tmp/$LIB install -vm755 /tmp/$LIB /usr/lib rm /tmp/$LIB -done +done</userinput><userinput arch="ml_32,ml_all"> +for LIB in $online_usrlib; do + cp /usr/lib32/$LIB /tmp/$LIB + strip --strip-unneeded /tmp/$LIB + install -vm755 /tmp/$LIB /usr/lib32 + rm /tmp/$LIB +done</userinput><userinput arch="ml_x32,ml_all"> +for LIB in $online_usrlib; do + cp /usr/libx32/$LIB /tmp/$LIB + strip --strip-unneeded /tmp/$LIB + install -vm755 /tmp/$LIB /usr/libx32 + rm /tmp/$LIB +done</userinput><userinput> for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \ $(find /usr/lib -type f -name \*.a) \ @@ -98,7 +129,23 @@ for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \ * ) strip --strip-unneeded $i ;; esac -done +done</userinput><userinput arch="ml_32,ml_all"> +for i in $(find /usr/lib32 -type f -name \*.so* ! -name \*dbg); do + case "$online_usrbin $online_usrlib $save_usrlib" in + *$(basename $i)* ) + ;; + * ) strip --strip-unneeded $i + ;; + esac +done</userinput><userinput arch="ml_x32,ml_all"> +for i in $(find /usr/libx32 -type f -name \*.so* ! -name \*dbg); do + case "$online_usrbin $online_usrlib $save_usrlib" in + *$(basename $i)* ) + ;; + * ) strip --strip-unneeded $i + ;; + esac +done</userinput><userinput> unset BIN LIB save_usrlib online_usrbin online_usrlib </userinput></screen> diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml index 67b27b8d8..54e376919 100644 --- a/chapter08/systemd.xml +++ b/chapter08/systemd.xml @@ -219,6 +219,133 @@ meson --prefix=/usr \ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of systemd - 32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">rm -rf *</userinput></screen> + + <para>Create a symlink to work around missing xsltproc:</para> + +<!-- screen><userinput remap="pre">ln -sf /tools/bin/true /usr/bin/xsltproc</userinput></screen --> +<screen><userinput remap="pre">ln -sf /bin/true /usr/bin/xsltproc</userinput></screen> + +<!-- with cross-LFS we have util-linux in place: + <para>Because we have not yet installed the final version of Util-Linux, + create links to the libraries in the approprite location:</para> + +<screen><userinput remap="pre">for file in /tools/lib32/lib{blkid,mount,uuid}*; do + ln -sf $file /usr/lib32/ +done</userinput></screen> +--> + + <para>Prepare systemd for compilation:</para> + + <screen><userinput remap="configure">PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \ +CC="gcc -m32 -march=i686" \ +CXX="g++ -m32 -march=i686" \ +LANG=en_US.UTF-8 \ +meson --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + -Dblkid=true \ + -Dbuildtype=release \ + -Ddefault-dnssec=no \ + -Dfirstboot=false \ + -Dinstall-tests=false \ + -Dkill-path=/bin/kill \ + -Dkmod-path=/bin/kmod \ + -Dldconfig=false \ + -Dmount-path=/bin/mount \ + -Drootprefix= \ + -Drootlibdir=/usr/lib32 \ + -Dsplit-usr=true \ + -Dsulogin-path=/sbin/sulogin \ + -Dsysusers=false \ + -Dumount-path=/bin/umount \ + -Db_lto=false \ + ..</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">LANG=en_US.UTF-8 ninja</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">LANG=en_US.UTF-8 DESTDIR=$PWD/DESTDIR ninja install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR +rm -f /usr/bin/xsltproc</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of systemd - x32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">rm -rf *</userinput></screen> + + <para>Create a symlink to work around missing xsltproc:</para> + +<screen><userinput remap="pre">ln -sf /bin/true /usr/bin/xsltproc</userinput></screen> + + <para>Fix an issue on x32:</para> + +<screen><userinput remap="pre">sed '/log_debug/s@PRI_TIMEX@PRIi64@' -i src/timesync/timesyncd-manager.c +sed '/long drift_freq;/s@long @int64_t @' -i src/timesync/timesyncd-manager.h</userinput></screen> + + <para>Prepare systemd for compilation:</para> + +<screen><userinput remap="configure">PKG_CONFIG_PATH="/usr/libx32/pkgconfig" \ +CC="gcc -mx32" \ +CXX="g++ -mx32" \ +CFLAGS+="-Wno-error=shift-overflow" \ +CXXFLAGS+="-Wno-error=shift-overflow" \ +LANG=en_US.UTF-8 \ +meson --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + -Dblkid=true \ + -Dbuildtype=release \ + -Ddefault-dnssec=no \ + -Dfirstboot=false \ + -Dinstall-tests=false \ + -Dkill-path=/bin/kill \ + -Dkmod-path=/bin/kmod \ + -Dldconfig=false \ + -Dmount-path=/bin/mount \ + -Drootprefix= \ + -Drootlibdir=/usr/libx32 \ + -Dsplit-usr=true \ + -Dsulogin-path=/sbin/sulogin \ + -Dsysusers=false \ + -Dumount-path=/bin/umount \ + -Db_lto=false \ + ..</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">LANG=en_US.UTF-8 ninja</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">LANG=en_US.UTF-8 DESTDIR=$PWD/DESTDIR ninja install +cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR +rm -f /usr/bin/xsltproc</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-systemd" role="content"> <title>Contents of systemd</title> diff --git a/chapter08/util-linux.xml b/chapter08/util-linux.xml index bcc3c98bd..b3af8ff89 100644 --- a/chapter08/util-linux.xml +++ b/chapter08/util-linux.xml @@ -116,6 +116,124 @@ su tester -c "make -k check"</userinput></screen> --> </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Util-linux - 32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Util-linux for compilation:</para> + +<screen revision="sysv"><userinput remap="configure">CC="gcc -m32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --host=i686-pc-linux-gnu \ + --libdir=/usr/lib32 \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --without-systemd \ + --without-systemdsystemunitdir \ + --enable-libmount-force-mountinfo</userinput></screen> + +<screen revision="systemd"><userinput remap="configure">CC="gcc -m32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --host=i686-pc-linux-gnu \ + --libdir=/usr/lib32 \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --enable-libmount-force-mountinfo</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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Util-linux - x32-bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Util-linux for compilation:</para> + +<screen revision="sysv"><userinput remap="configure">CC="gcc -mx32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --host=x86_64-pc-linux-gnux32 \ + --libdir=/usr/libx32 \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --without-systemd \ + --without-systemdsystemunitdir \ + --enable-libmount-force-mountinfo</userinput></screen> + +<screen revision="systemd"><userinput remap="configure">CC="gcc -mx32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --host=x86_64-pc-linux-gnux32 \ + --libdir=/usr/libx32 \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --enable-libmount-force-mountinfo</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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-utillinux" role="content"> <title>Contents of Util-linux</title> diff --git a/chapter08/xz.xml b/chapter08/xz.xml index 7f723482a..faac1a090 100644 --- a/chapter08/xz.xml +++ b/chapter08/xz.xml @@ -64,6 +64,68 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Xz - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Xz for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" ./configure \ + --host=i686-pc-linux-gnu \ + --prefix=/usr \ + --libdir=/usr/lib32 \ + --disable-static</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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Xz - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Xz for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" ./configure \ + --host=x86_64-pc-linux-gnux32 \ + --prefix=/usr \ + --libdir=/usr/libx32 \ + --disable-static</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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-xz" role="content"> <title>Contents of Xz</title> diff --git a/chapter08/zlib.xml b/chapter08/zlib.xml index 604d5d503..a90c7c416 100644 --- a/chapter08/zlib.xml +++ b/chapter08/zlib.xml @@ -63,6 +63,62 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Zlib - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Zlib for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -m32" \ +./configure --prefix=/usr \ + --libdir=/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 -Rv DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Zlib - x32bit</title> + +<screen><userinput remap="pre">make distclean</userinput></screen> + + <para>Prepare Zlib for compilation:</para> + +<screen><userinput remap="configure">CC="gcc -mx32" \ +./configure --prefix=/usr \ + --libdir=/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 -Rv DESTDIR/usr/libx32/* /usr/libx32 +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-zlib" role="content"> <title>Contents of Zlib</title> diff --git a/chapter08/zstd.xml b/chapter08/zstd.xml index 1d0c603f6..a6cc35219 100644 --- a/chapter08/zstd.xml +++ b/chapter08/zstd.xml @@ -65,6 +65,54 @@ </sect2> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_32,ml_all" role="installation"> + <title>Installation of Zstd - 32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make clean</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">CC="gcc -m32" make</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make prefix=/usr DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib/* /usr/lib32/ +sed -e "/^libdir/s/lib$/lib32/" -i /usr/lib32/pkgconfig/libzstd.pc +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- m32 --> + + <!-- - - - - - - - - - --> + <!-- Multilib - x32bit --> + <!-- - - - - - - - - - --> + + <sect2 arch="ml_x32,ml_all" role="installation"> + <title>Installation of Zstd - x32bit</title> + + <para>Clean previous build:</para> + +<screen><userinput remap="pre">make clean</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">CC="gcc -mx32" make</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make prefix=/usr DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib/* /usr/libx32/ +sed -e "/^libdir/s/lib$/libx32/" -i /usr/libx32/pkgconfig/libzstd.pc +rm -rf DESTDIR</userinput></screen> + + </sect2><!-- mx32 --> + <sect2 id="contents-zstd" role="content"> <title>Contents of Zstd</title> diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml index 1a2861856..742ae9d88 100644 --- a/chapter10/kernel.xml +++ b/chapter10/kernel.xml @@ -155,6 +155,39 @@ File systems ---> the BLFS page</ulink>.</para> </note> + <note arch="ml_32,ml_x32,ml_all"> + <para> + The kernel on a multilib system needs to be able to + identify and start binaries compiled for different architectures + than the default. + </para> + + <para arch="ml_32,ml_all"> + If support for any 32bit ABI was built, make sure that the option + "IA32 Emulation" is selected. The option 'IA32 a.out support' is + optional. + </para> + + <para arch="ml_x32,ml_all"> + If support for the x32bit ABI was built, make sure that the option + "x32 ABI for 64-bit mode" is selected. + </para> + +<screen arch="ml_32">Binary Emulations ---> + [*] IA32 Emulation + <M> IA32 a.out support +</screen> +<screen arch="ml_x32">Binary Emulations ---> + [*] x32 ABI for 64-bit mode +</screen> +<screen arch="ml_all">Binary Emulations ---> + [*] IA32 Emulation + <M> IA32 a.out support + [*] x32 ABI for 64-bit mode +</screen> + + </note> + <variablelist> <title>The rationale for the above configuration items:</title> diff --git a/packages.ent b/packages.ent index d381c67c5..5724ac3b8 100644 --- a/packages.ent +++ b/packages.ent @@ -354,6 +354,14 @@ <!ENTITY iproute2-fin-du "15 MB"> <!ENTITY iproute2-fin-sbu "0.2 SBU"> +<!ENTITY isl-version "0.22.1"> +<!ENTITY isl-size "1.6 MB"> +<!ENTITY isl-url "http://isl.gforge.inria.fr/isl-&isl-version;.tar.xz"> +<!ENTITY isl-md5 "6e124849a9b62e3e2d5d51e955323f6e"> +<!ENTITY isl-home "http://isl.gforge.inria.fr/"> +<!ENTITY isl-fin-du "20 MB"> +<!ENTITY isl-fin-sbu "0.1 SBU"> + <!ENTITY jinja2-version "3.0.1"> <!ENTITY jinja2-size "264 KB"> <!ENTITY jinja2-url "https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-&jinja2-version;.tar.gz"> diff --git a/prologue/bookinfo.xml b/prologue/bookinfo.xml index 73d06410d..61b845b17 100644 --- a/prologue/bookinfo.xml +++ b/prologue/bookinfo.xml @@ -7,8 +7,10 @@ <bookinfo> <title>Linux From Scratch</title> - <subtitle revision='sysv' >Version &version; </subtitle> - <subtitle revision='systemd'>Version &versiond;</subtitle> + <subtitle arch="default" revision='sysv'>Version &version;</subtitle> + <subtitle arch="default" revision='systemd'>Version &versiond;</subtitle> + <subtitle arch="ml_32,ml_x32,ml_all" revision='sysv'>Version &version;-multilib</subtitle> + <subtitle arch="ml_32,ml_x32,ml_all" revision='systemd'>Version &versiond;-multilib</subtitle> <subtitle>Published &releasedate;</subtitle> <authorgroup> @@ -30,6 +32,11 @@ <firstname>Editor: DJ</firstname> <surname>Lucas</surname> </author> + + <author arch="ml_32,ml_x32,ml_all"> + <firstname>Editor: Thomas</firstname> + <surname>Trepl</surname> + </author> </authorgroup> <copyright id="copyright"> diff --git a/prologue/multilib.xml b/prologue/multilib.xml new file mode 100644 index 000000000..a579d2c3a --- /dev/null +++ b/prologue/multilib.xml @@ -0,0 +1,99 @@ +<?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="pre-multilib"> + <?dbhtml filename="multilib.html"?> + + <title>About the Multilib Edition</title> + + <sect2><title>What is Multilib</title> + + <para>Today, most systems in the x86 world have a word size of 64 + bit. The word size is a number of bits which can be used at once + in the most efficient way. Previous architectures of x86 processors + had a word size of 32 bit which means they have a different + understanding of what is the best alignment of data in memory as + well as they have a different mechanism to address a different size + of memory. Even the instruction set of the 64 bit processors is + quite simmilar to the instructions of 32 bit processors, binaries + (objects compiled to machine code) cannot directly be executed on + 64 bit systems.</para> + + <para>Multilib is a mechanism to provide support for the 32 bit + binaries so that they can be executed of modern 64 bit CPUs.</para> + + </sect2> + + <sect2><title>Why doing Multilib?</title> + + <para>From a educational point of view, LFS in its 'native' form is + probably the best way to see how a Linux system is built from source. + There is no need to confuse with different architectures. But when + there is a need to run 32 binaries and you don't want to build the + whole system in 32 bit (which would be waste of ressources + nowadays) than LFS-multilib is an option. Examples for such a + need could be + <itemizedlist> + <listitem><para>Closed-source software without source only + available for 32 bit. That may be the case for printer driver + or any other kind of hardware drivers, the company provides + the binaries. If you have such a driver, LFS-multilib + may help you getting the stuff running</para> + </listitem> + <listitem><para>If you want to go far beyond LFS and setup a + virtualization platform like <application>VirtualBox</application>, + you will need multilib support</para> + </listitem> + <listitem><para>or even just because you can</para> + </listitem> + </itemizedlist> + + </para> + + <para>The multilib edition of LFS goes a small step beyond and a + small step back to what has been said in the previous section + when talking about target architectures. On one hand, the multilib + edition is focused and <emphasis>limited</emphasis> to x86_64 + architectures only, on the other hand, it <emphasis>expands</emphasis> + the instructions to utilize both possible architectures, namely + 32-bit as well as 64-bit.</para> + + <para>It also goes a bit beyond the basic educational + approach of LFS which is to show you how to build a Linux system. + To achieve this, no support for additional architectures than + the default one for your system is required. If you haven't + previously built by the standard LFS book, you are encouraged to + do so before using this edition.</para> + + </sect2> + + <sect2><title>Building a Multilib System</title> + + <para>Building a multilib system is not that much different from + building a system by using the 'native' LFS book. Beside some + tweaks here and there the most prominent difference is that + multilib requires compiling some applications up to three times: + one for the primary 64-bit architecture, + one for the 32-bit architecture (m32), + and once again for the 32-bit architecture with is 32-bit memory + access and 64 bit instruction set (mx32).</para> + + <para>Continue only if you and your system meets the following + requirements: + <itemizedlist> + <listitem><para>you have a x86_64 compatible machine</para></listitem> + <listitem><para>you already have some experience with LFS</para></listitem> + <listitem><para>you have a need for 32-bit support</para></listitem> + </itemizedlist> + </para> + + <para>If you passed all three requirements, go ahead and build LFS + in multilib mode.</para> + + </sect2> + +</sect1> diff --git a/prologue/preface.xml b/prologue/preface.xml index e940116e1..a4160c49d 100644 --- a/prologue/preface.xml +++ b/prologue/preface.xml @@ -15,6 +15,7 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="audience.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="architecture.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="prerequisites.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="multilib.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="standards.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="why.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="typography.xml"/> |