Ref: http://www.linuxfromscratch.org/~dj/lfs-systemd-multilib/chapter10/chapter10.html tce-load -i compiletc texinfo python3.6 gettext coreutils mkdir /opt/temptools export PATH_HOLD="${PATH}" export PATH="/opt/temptools/bin:${PATH}" cd binutils-2.33.1 mkdir build cd build ../configure --prefix=/opt/temptools --disable-nls --disable-static --disable-werror --enable-64-bit-bfd --enable-gold --with-ld=default --enable-multilib --target=x86_64-unknown-linux-gnu --with-sysroot=/opt/temptools --with-lib-path=/opt/temptools/lib:/opt/temptools/lib32:/opt/temptools/libx32 make -j3 [5m 0.67s] make install cd gcc-9.2.0 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 tar -xf ../mpfr-4.0.2.tar.xz mv -v mpfr-4.0.2 mpfr tar -xf ../gmp-6.1.2.tar.xz mv -v gmp-6.1.2 gmp tar -xf ../mpc-1.1.0.tar.gz mv -v mpc-1.1.0 mpc mkdir build cd build ../configure --target=x86_64-unknown-linux-gnu --prefix=/opt/temptools --disable-nls --disable-shared --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libmpx --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++ --with-glibc-version=2.11 --with-slibdir=/opt/temptools/lib --with-sysroot=/opt/temptools --with-newlib --without-headers --with-local-prefix=/opt/temptools --with-multilib-list=m32,m64,mx32 --with-native-system-header-dir=/opt/temptools/include make -j3 [13m 57.25s] make install cd glibc-2.30 edit manual/libc.texinfo remove @documentencoding UTF-8 patch -Np1 -i ../glibc-2.30-fhs-1.patch mkdir build cd build BUILD_CC="gcc" BUILD_CXX=g++ CC="x86_64-unknown-linux-gnu-gcc -m32" CXX="x86_64-unknown-linux-gnu-g++ -m32" AR="x86_64-unknown-linux-gnu-ar" RANLIB="x86_64-unknown-linux-gnu-ranlib" ../configure --prefix=/usr --build=x86_64-unknown-linux-gnu --host=i686-pc-linux-gnu --enable-kernel=3.2 --enable-multi-arch --libdir=/usr/lib32 --with-headers=/usr/include --with-binutils=/opt/temptools/bin libc_cv_slibdir=/usr/lib32 make -j3 [4m 52.61s] make install_root="${PWD}/DESTDIR" install sudo install -vdm755 /usr/lib32 sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 sudo install -vm644 DESTDIR/usr/include/gnu/lib-names-32.h /usr/include/gnu/ sudo install -vm644 DESTDIR/usr/include/gnu/stubs-32.h /usr/include/gnu/ sudo ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2 sudo ln -svf ../lib/locale /usr/lib32/locale sudo echo "/usr/lib32" >> /etc/ld.so.conf export PATH="${PATH_HOLD}" unset PATH_HOLD sudo rm -r /opt/temptools cd binutils-2.33.1 (multi-lib) mkdir build cd build ../configure --prefix=/usr/local --enable-gold --enable-ld=default --enable-multilib --enable-plugins --enable-shared --disable-werror --with-system-zlib --with-lib-path=/usr/lib:/lib:/usr/lib32:/usr/libx32:/usr/local/lib:/usr/local/lib32 make -j3 tooldir=/usr/local [5m 20.43s] sudo make tooldir=/usr/local install tce-load -i mpc-dev cd gcc-9.2.0 (multi-lib) 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 edit gcc/config/i386/linux64.h #define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2" mkdir build cd build ../configure --prefix=/usr/local --enable-languages=c,c++ --enable-multilib --disable-bootstrap --with-system-zlib --libexecdir=/usr/local/lib --with-mpfr=/usr/local --with-gmp=/usr/local --with-mpc=/usr/local make -j3 [20m 21.93s] sudo make install sudo install -vdm755 /usr/local/share/gdb/auto-load/usr/lib sudo mv -v /usr/local/lib/*gdb.py /usr/local/share/gdb/auto-load/usr/lib sudo install -vdm755 /usr/local/share/gdb/auto-load/usr/lib32 sudo mv -v /usr/local/lib32/*gdb.py /usr/local/share/gdb/auto-load/usr/lib32/ sudo echo "/usr/local/lib32" >> /etc/ld.so.conf cd glibc-2.30 multi-lib edit manual/libc.texinfo remove @documentencoding UTF-8 patch -Np1 -i ../glibc-2.30-fhs-1.patch mkdir build64 cd build64 ../configure --prefix=/usr --disable-werror --enable-multi-arch --enable-stack-protector=strong libc_cv_slibdir=/lib --libexecdir=/usr/lib/glibc --enable-kernel=4.19.10 --enable-obsolete-rpc make -j3 [5m 9.07s] sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile sudo make install install_root=/tmp/pkg64 mkdir -v ../build32 cd ../build32 CC="gcc -m32" CXX="g++ -m32" ../configure --prefix=/usr --disable-werror --enable-multi-arch --enable-stack-protector=strong --libdir=/usr/lib32 libc_cv_slibdir=/usr/lib32 --libexecdir=/usr/lib32/glibc --enable-kernel=4.19.10 --enable-obsolete-rpc i686-pc-linux-gnu make -j3 [5m 3.89s] sudo make install_root=$PWD/DESTDIR install sudo mv -v DESTDIR/usr/lib32/* /usr/lib32/ sudo install -vm644 DESTDIR/usr/include/gnu/lib-names-32.h /usr/include/gnu/ sudo install -vm644 DESTDIR/usr/include/gnu/stubs-32.h /usr/include/gnu/ ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2 ln -svf ../lib/locale /usr/lib32/locale Note These instructions assume that you've already completed LFS, and are adding to an existing system. If that is not the case, or if you are packaging the build, you will need to complete all of the steps in the Chapter 6 Glibc build. cd zlib-1.2.11 CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" ./configure --prefix=/usr --libdir=/usr/lib32 find . -name Makefile -type f -exec sed -i 's/-O3//g' {} \; make [0m 3.89s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cd file-5.37 CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" ./configure --prefix=/usr --libdir=/usr/lib32 find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \; make [0m 3.60s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cd bzip2-1.0.8 sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile find . -name Makefile-libbz2_so -type f -exec sed -i 's/-O2 -g//g' {} \; make CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" BIGFILES="" -f Makefile-libbz2_so make clean find . -name Makefile -type f -exec sed -i 's/-O2 -g//g' {} \; make CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" BIGFILES="" make PREFIX=$PWD/DESTDIR/usr install sudo cp -Rv DESTDIR/usr/lib/* /usr/lib32 sudo cp -av libbz2.so* /usr/lib32 cd ncurses-6.1 sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" CXX="g++ -m32 -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr --libdir=/usr/lib32 --mandir=/usr/share/man --with-shared --without-debug --without-normal --enable-pc-files --enable-widec find . -name Makefile -type f -exec sed -i 's/-O2//g' {} \; make [0m 34.48s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cd attr-2.4.48 CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" ./configure --prefix=/usr --disable-static --sysconfdir=/etc --libdir=/usr/lib32 find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \; make [0m 1.55s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 tce-load -i attr-dev cd acl-2.2.53 CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" ./configure --prefix=/usr --libdir=/usr/lib32 --disable-static --libexecdir=/usr/lib32 find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \; make [0m 4.46s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cd libcap-2.25 sed -i '/install.*STALIBNAME/d' libcap/Makefile find . -name Make.Rules -type f -exec sed -i 's/-O2//g' {} \; make CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" [0m 0.89s] make lib=lib32 prefix=$PWD/DESTDIR/usr -C libcap install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cd xz-5.2.4 CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" ./configure --prefix=/usr --disable-static --libdir=/usr/lib32 find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \; make [0m 10.18s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32 cd util-linux-2.34 add tty:x:4: to /etc/group CC="gcc -m32 -march=i486 -mtune=i686 -Os -pipe" ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime --docdir=/usr/share/doc/util-linux-2.32.1 --disable-chfn-chsh --disable-login --disable-nologin --disable-su --disable-setpriv --disable-runuser --disable-pylibmount --disable-static --without-python --without-systemd --libdir=/usr/lib32 --enable-libmount-force-mountinfo find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \; make [1m 6.40s] make DESTDIR=$PWD/DESTDIR install sudo cp -Rv DESTDIR/usr/lib32/* /usr/lib32