Lfs-multilib/blfs

From www.williamfeely.info
Jump to: navigation, search

These packages are currently in the process of being transferred to https://www.williamfeely.info/blfs-multilib/

Converted packages will be replaced with a URL to their respective book page.

Dependencies that link to official BLFS pages do not need to be built in a multilib configuration, and can be built using the BLFS book.

Building Autoconf based packages as multilib

These are generic instructions for building a package with a configure script. Replace <configure options> with the options normally used to configure the package. Library dependencies require that particular platform to be satisfied before the build will succeed.

When building an Autoconf based package as multilib, first configure it as 32-bit:

BUILDENV=32 ./configure <configure options> \
         --libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next clean the build folder and configure as x32 ABI:

make clean
BUILDENV=x32 ./configure <configure options> \
         --libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install

Finally, clean the build folder one more time and configure as default, which is 64-bit:

make clean
./configure <configure options>
make
make check
make install

There may be additional options you may need to add. For example:

F77=`gfortran -m32`    F77=`gfortran -mx32`

GCC

https://www.williamfeely.info/blfs-multilib/general/gcc.html

Check

First install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr --disable-static --libdir=/usr/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make docdir=/usr/share/doc/check-0.9.12 install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr --disable-static --libdir=/usr/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make docdir=/usr/share/doc/check-0.9.12 install

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --disable-static
make
make check
make docdir=/usr/share/doc/check-0.9.12 install

libpng

After applying the apng patch, install the 32-bit version:

./configure --prefix=/usr --disable-static \
            libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install
mv -v /usr/bin/libpng16-config{,-32}
ln -sfv libpng16-config-32 /usr/bin/libpng-config-32

Next install the x32 ABI version:

make clean
./configure --prefix=/usr --disable-static \
            libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install
mv -v /usr/bin/libpng16-config{,-x32} &&
ln -sfv libpng16-config-x32 /usr/bin/libpng-config-x32

Finally install the 64-bit version and the documentation:

make clean
./configure --prefix=/usr --disable-static
make
make check
make install
mv -v /usr/bin/libpng16-config{,-64}
ln -sfv libpng16-config-64 /usr/bin/libpng-config-64
ln -sfv multiarch_wrapper /usr/bin/libpng-config
ln -sfv multiarch_wrapper /usr/bin/libpng16-config
mkdir -v /usr/share/doc/libpng-1.6.8
cp -v README libpng-manual.txt /usr/share/doc/libpng-1.6.8

FreeType

Dependencies:

Which (non-multilib)

libpng (multilib)

After unpacking the documentation and applying the sed patches, install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr --disable-static \
            libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make install
mv -v /usr/bin/freetype-config{,-32}

Next install the x32 ABI version:

make distclean
BUILDENV=x32 ./configure --prefix=/usr --disable-static \
            libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install
mv -v /usr/bin/freetype-config{,-x32}

Finally install the 64-bit version and the documentation:

make distclean
./configure --prefix=/usr --disable-static
make
make install
mv -v /usr/bin/freetype-config{,-64}
ln -sfv multiarch_wrapper /usr/bin/freetype-config
install -v -m755 -d /usr/share/doc/freetype-2.5.2 &&
cp -v -R docs/*     /usr/share/doc/freetype-2.5.2

Pth

First fix the Makefile and install the 32-bit version:

sed -i 's#$(LOBJS): Makefile#$(LOBJS): pth_p.h Makefile#' Makefile.in
BUILDENV=32 ./configure --prefix=/usr           \
            --disable-static        \
            --mandir=/usr/share/man \
            --libdir=/usr/lib32     \
            CC=`gcc -m32` CXX=`g++ -m32` F77=`gfortran -m32`
make
make test
make install
mv -v /usr/bin/pth-config{,-32}

Next install the x32 ABI version:

make distclean
BUILDENV=x32 ./configure --prefix=/usr           \
            --disable-static        \
            --mandir=/usr/share/man \
            --libdir=/usr/libx32     \
            CC=`gcc -mx32` CXX=`g++ -mx32` F77=`gfortran -mx32`
make
make test
make install
mv -v /usr/bin/pth-config{,-x32}

Finally install the 64-bit version:

make distclean
./configure --prefix=/usr           \
            --disable-static        \
            --mandir=/usr/share/man
make
make test
make install
mv -v /usr/bin/pth-config{,-64}
ln -sfv multiarch_wrapper /usr/bin/pth-config
install -v -m755 -d /usr/share/doc/pth-2.0.7
install -v -m644    README PORTING SUPPORT TESTS \
                    /usr/share/doc/pth-2.0.7

attr

https://www.williamfeely.info/blfs-multilib/postlfs/attr.html

OpenSSL

Dependencies:

MIT Kerberos V5 (multilib, circular dependency, rebuild OpenSSL after installing)

Required patches:

https://www.williamfeely.info/download/lfs-multilib/openssl-1.0.1-x32.patch

Retrieved from https://raw.github.com/fantix/ArchLinux-x32/master/libx32-openssl/openssl-1.0.1-x32.patch, modified to fix build process.

https://www.williamfeely.info/download/lfs-multilib/openssl-1.0.1c-32bit_x86_64-1.patch

Retrieved from http://svn.cross-lfs.org/svn/repos/patches/openssl/openssl-1.0.1c-32bit_x86_64-1.patch

After applying the BLFS patches, apply the x32 patch and the multiarch 32-bit patch:

patch -Np1 -i ../openssl-1.0.1-x32.patch
patch -Np1 -i ../openssl-1.0.1c-32bit_x86_64-1.patch

First build the 32-bit version:

BUILDENV=32 \
./Configure linux-x86_64-32    \
         --prefix=/usr         \
         --openssldir=/etc/ssl \
         --libdir=lib32        \
         shared                \
         zlib-dynamic
make
make test
sed -i 's# libcrypto.a##;s# libssl.a##' Makefile
make MANDIR=/usr/share/man MANSUFFIX=ssl install

Next install the x32 ABI version:

make clean
BUILDENV=x32 \
./Configure linux-x32          \
         --prefix=/usr         \
         --openssldir=/etc/ssl \
         --libdir=libx32       \
         shared                \
         zlib-dynamic
make
make test
sed -i 's# libcrypto.a##;s# libssl.a##' Makefile
make MANDIR=/usr/share/man MANSUFFIX=ssl install

Finally install the 64-bit version:

make clean
./config --prefix=/usr         \
         --openssldir=/etc/ssl \
         --libdir=lib          \
         shared                \
         zlib-dynamic
make
make test
sed -i 's# libcrypto.a##;s# libssl.a##' Makefile
make MANDIR=/usr/share/man MANSUFFIX=ssl install
install -dv -m755 /usr/share/doc/openssl-1.0.1f
cp -vfr doc/*     /usr/share/doc/openssl-1.0.1f

Tcl

https://www.williamfeely.info/blfs-multilib/general/tcl.html

Berkeley DB

Dependencies:

TCL (multilib)

OpenJDK/IcedTea (not multilib compatible, only available for 64-bit libraries)

Sharutils (non-multilib)

First install the 32-bit version:

cd build_unix
../dist/configure --prefix=/usr      \
                  --enable-compat185 \
                  --enable-dbm       \
                  --disable-static   \
                  --enable-cxx       \
                  --libdir=/usr/lib32 \
                  CC=`gcc -m32` CXX=`g++ -m32`
make
make docdir=/usr/share/doc/db-6.0.20 install
chown -v -R root:root                        \
      /usr/bin/db_*                          \
      /usr/include/db{,_185,_cxx}.h          \
      /usr/lib32/libdb*.{so,la}                \
      /usr/share/doc/db-6.0.20

Next install the x32 ABI version:

make clean
../dist/configure --prefix=/usr      \
                  --enable-compat185 \
                  --enable-dbm       \
                  --disable-static   \
                  --enable-cxx       \
                  --libdir=/usr/libx32 \
                  CC=`gcc -mx32` CXX=`g++ -mx32`
make
make docdir=/usr/share/doc/db-6.0.20 install
chown -v -R root:root                        \
      /usr/bin/db_*                          \
      /usr/include/db{,_185,_cxx}.h          \
      /usr/libx32/libdb*.{so,la}                \
      /usr/share/doc/db-6.0.20

Finally install the 64-bit version:

make clean
../dist/configure --prefix=/usr      \
                  --enable-compat185 \
                  --enable-dbm       \
                  --disable-static   \
                  --enable-cxx
make
make docdir=/usr/share/doc/db-6.0.20 install
chown -v -R root:root                        \
      /usr/bin/db_*                          \
      /usr/include/db{,_185,_cxx}.h          \
      /usr/lib/libdb*.{so,la}                \
      /usr/share/doc/db-6.0.20

Expat

First install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr --disable-static \
            libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr --disable-static \
            libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install

Finally install the 64-bit version and the documentation:

make clean
./configure --prefix=/usr --disable-static
make
make install
install -v -m755 -d /usr/share/doc/expat-2.1.0
install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.1.0

libffi

Dependencies:

DejaGnu (non-multilib)

After applying the patch, first install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr --disable-static \
            libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr --disable-static \
            libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32` \
            --host=x86_64-unknown-linux-gnux32
make
make check
make install

Finally install the 64-bit version and the documentation:

make clean
./configure --prefix=/usr --disable-static
make
make check
make install

CrackLib

Optional dependency:

Python 2 (Multilib instructions TBA)

First install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr \
            --with-default-dict=/lib/cracklib/pw_dict \
            --disable-static \
            --libdir=/usr/lib32 \
            --without-python \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make install
mv -v /usr/lib32/libcrack.so.2* /lib32
ln -v -sf ../../lib32/libcrack.so.2.9.0 /usr/lib32/libcrack.so

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr \
            --with-default-dict=/lib/cracklib/pw_dict \
            --disable-static \
            --libdir=/usr/libx32 \
            --without-python \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install
mv -v /usr/libx32/libcrack.so.2* /libx32
ln -v -sf ../../libx32/libcrack.so.2.9.0 /usr/libx32/libcrack.so

Finally install the 64-bit version:

make clean
./configure --prefix=/usr \
            --with-default-dict=/lib/cracklib/pw_dict \
            --disable-static
make
make install
mv -v /usr/lib/libcrack.so.2* /lib
ln -v -sf ../../lib/libcrack.so.2.9.0 /usr/lib/libcrack.so

Install the dictionaries per BLFS instructions.

libtirpc

Optional dependency:

MIT Kerberos V5 (no multilib instructions currently)

After applying the patch and running autoreconf, first install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr     \
            --sysconfdir=/etc \
            --disable-static  \
            --disable-gssapi  \
            --libdir=/usr/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make install
mv -v /usr/lib32/libtirpc.so.* /lib32
ln -sfv ../../lib32/libtirpc.so.1.0.10 /usr/lib32/libtirpc.so

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr     \
            --sysconfdir=/etc \
            --disable-static  \
            --disable-gssapi  \
            --libdir=/usr/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install
mv -v /usr/libx32/libtirpc.so.* /libx32
ln -sfv ../../libx32/libtirpc.so.1.0.10 /usr/libx32/libtirpc.so

Finally install the 64-bit version:

make clean
./configure --prefix=/usr     \
            --sysconfdir=/etc \
            --disable-static  \
            --disable-gssapi
make
make install
mv -v /usr/lib/libtirpc.so.* /lib
ln -sfv ../../lib/libtirpc.so.1.0.10 /usr/lib/libtirpc.so

Linux-PAM

Dependencies:

libtirpc (multilib)

CrackLib (multilib)

Berkeley DB (multilib)

First install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr \
            --sysconfdir=/etc \
            --libdir=/usr/lib32 \
            --enable-securedir=/lib32/security \
            --docdir=/usr/share/doc/Linux-PAM-1.1.8 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make install
chmod -v 4755 /sbin/unix_chkpwd
for file in pam pam_misc pamc
do
  mv -v /usr/lib32/lib${file}.so.* /lib32 &&
  ln -sfv ../../lib32/$(readlink /usr/lib32/lib${file}.so) /usr/lib32/lib${file}.so
done

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr \
            --sysconfdir=/etc \
            --libdir=/usr/libx32 \
            --enable-securedir=/libx32/security \
            --docdir=/usr/share/doc/Linux-PAM-1.1.8 \
            CC=`gcc -mx32` CXX=`g++ -mx32`  YACC=
make
make install
chmod -v 4755 /sbin/unix_chkpwd
for file in pam pam_misc pamc
do
  mv -v /usr/libx32/lib${file}.so.* /libx32 &&
  ln -sfv ../../libx32/$(readlink /usr/libx32/lib${file}.so) /usr/libx32/lib${file}.so
done

Finally install the 64-bit version:

make clean
./configure --prefix=/usr \
            --sysconfdir=/etc \
            --libdir=/usr/lib \
            --enable-securedir=/lib/security \
            --docdir=/usr/share/doc/Linux-PAM-1.1.8
make
make install
chmod -v 4755 /sbin/unix_chkpwd
for file in pam pam_misc pamc
do
  mv -v /usr/lib/lib${file}.so.* /lib &&
  ln -sfv ../../lib/$(readlink /usr/lib/lib${file}.so) /usr/lib/lib${file}.so
done

Follow the BLFS instructions for configuration and testing.

libcap

First install the 32-bit version:

sed -i 's:LIBDIR:PAM_&:g' pam_cap/Makefile
make CC=`gcc -m32` CXX=`g++ -m32`
sed -i '/install.*STALIBNAME/ s/^/#/' libcap/Makefile
make prefix=/usr \
     SBINDIR=/sbin \
     PAM_LIBDIR=/lib32 \
     LIBDIR=/usr/lib32 \
     RAISE_SETFCAP=no \
     CC=`gcc -m32` CXX=`g++ -m32` install
chmod -v 755 /usr/lib32/libcap.so
mv -v /usr/lib32/libcap.so.* /lib32
ln -sfv ../../lib32/libcap.so.2 /usr/lib32/libcap.so

Next install the x32 ABI version:

make clean
make CC=`gcc -mx32` CXX=`g++ -mx32`
make prefix=/usr \
     SBINDIR=/sbin \
     PAM_LIBDIR=/libx32 \
     LIBDIR=/usr/libx32 \
     RAISE_SETFCAP=no \
     CC=`gcc -m32` CXX=`g++ -m32` install
chmod -v 755 /usr/libx32/libcap.so
mv -v /usr/libx32/libcap.so.* /libx32
ln -sfv ../../libx32/libcap.so.2 /usr/libx32/libcap.so

Finally install the 64-bit version:

make clean
make
make prefix=/usr \
     SBINDIR=/sbin \
     PAM_LIBDIR=/lib \
     RAISE_SETFCAP=no install
chmod -v 755 /usr/lib/libcap.so
mv -v /usr/lib/libcap.so.* /lib
ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so

libgpg-error

First build the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr --disable-static \
--libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr --disable-static \
--libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --disable-static
make
make check
make install
install -v -m644 -D README /usr/share/doc/libgpg-error-1.12/README

libgcrypt

First install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr \
--with-capabilities --libdir=/usr/lib32 \
--host=i686-pc-linux-gnu \
CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr \
--with-capabilities --libdir=/usr/libx32 \
--host=x86_64-unknown-linux-gnux32 \
CC=`gcc -mx32` CXX=`g++ -mx32`
rm mpi/mpi-asm-defs.h
echo `#define BYTES_PER_MPI_LIMB 8` > mpi/mpi-asm-defs.h
make
make check
make install

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --with-capabilities
make
make check
make install
install -v -dm755   /usr/share/doc/libgcrypt-1.6.1
install -v -m644    README doc/{README.apichanges,fips*,libgcrypt*} \
                    /usr/share/doc/libgcrypt-1.6.1

Follow the BLFS instructions to install the additional documentation.

SQLite3

Dependencies:

UnZip (non-multilib)

First build the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr --disable-static        \
            CFLAGS=`-g -O2 -DSQLITE_ENABLE_FTS3=1 \
            -DSQLITE_ENABLE_COLUMN_METADATA=1     \
            -DSQLITE_ENABLE_UNLOCK_NOTIFY=1       \
            -DSQLITE_SECURE_DELETE=1`             \
            --libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make install

Next build the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr --disable-static        \
            CFLAGS=`-g -O2 -DSQLITE_ENABLE_FTS3=1 \
            -DSQLITE_ENABLE_COLUMN_METADATA=1     \
            -DSQLITE_ENABLE_UNLOCK_NOTIFY=1       \
            -DSQLITE_SECURE_DELETE=1`             \
            --libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --disable-static        \
            CFLAGS=`-g -O2 -DSQLITE_ENABLE_FTS3=1 \
            -DSQLITE_ENABLE_COLUMN_METADATA=1     \
            -DSQLITE_ENABLE_UNLOCK_NOTIFY=1       \
            -DSQLITE_SECURE_DELETE=1`
make
make install

Follow the BLFS instructions to install the documentation.

Python 2

Required patch:

https://www.williamfeely.info/download/lfs-multilib/Python-2.7.6-multilib-1.patch

Patch modified from http://svn.cross-lfs.org/svn/repos/patches/Python/Python-2.7.3-multilib-1.patch

Recommended dependencies:

Expat (multilib)

libffi (multilib)

Optional dependencies:

BlueZ (multilib)

Berkeley DB (multilib)

OpenSSL (multilib)

Lfs-multilib/blfs#SQLite3 SQLite3 (multilib)

Tk (multilib)

First install the 32-bit version:

patch -Np1 -i ../Python-2.7.6-multilib-1.patch
sed -i -e `s|@@MULTILIB_DIR@@|lib32|g` Lib/distutils/command/install.py \
       Lib/distutils/sysconfig.py \
       Lib/pydoc.py \
       Lib/site.py \
       Lib/sysconfig.py \
       Lib/test/test_dl.py \
       Lib/test/test_site.py \
       Lib/trace.py \
       Makefile.pre.in \
       Modules/getpath.c \
       setup.py
BUILDENV=32 ./configure --prefix=/usr       \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --enable-unicode=ucs4 \
            --libdir=/usr/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make test
make install
chmod -v 755 /usr/lib32/libpython2.7.so.1.0
mv -v /usr/bin/python{,-32}
mv -v /usr/bin/python2{,-32}
mv -v /usr/bin/python2.7{,-32}
mv -v /usr/include/python2.7/pyconfig{,-32}.h
ln -sfv python2.7-32 /usr/bin/python2-32
ln -sfv python2-32 /usr/bin/python-32

Clear the build folder and re-extract the Python-2.7.6.tar.xz file, then install the x32 ABI version:

patch -Np1 -i ../Python-2.7.6-multilib-1.patch
sed -i -e `s|@@MULTILIB_DIR@@|libx32|g` Lib/distutils/command/install.py \
       Lib/distutils/sysconfig.py \
       Lib/pydoc.py \
       Lib/site.py \
       Lib/sysconfig.py \
       Lib/test/test_dl.py \
       Lib/test/test_site.py \
       Lib/trace.py \
       Makefile.pre.in \
       Modules/getpath.c \
       setup.py
BUILDENV=x32 ./configure --prefix=/usr       \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --enable-unicode=ucs4 \
            --libdir=/usr/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make test
make install
chmod -v 755 /usr/lib32/libpython2.7.so.1.0
mv -v /usr/bin/python{,-x32}
mv -v /usr/bin/python2{,-x32}
mv -v /usr/bin/python2.7{,-x32}
mv -v /usr/include/python2.7/pyconfig{,-x32}.h
ln -sfv python2.7-x32 /usr/bin/python2-x32
ln -sfv python2-x32 /usr/bin/python-x32

Clear the build folder once more, extract the Python-2.7.6.tar.xz file, and install the 64-bit version:

patch -Np1 -i ../Python-2.7.6-multilib-1.patch
sed -i -e `s|@@MULTILIB_DIR@@|lib|g` Lib/distutils/command/install.py \
       Lib/distutils/sysconfig.py \
       Lib/pydoc.py \
       Lib/site.py \
       Lib/sysconfig.py \
       Lib/test/test_dl.py \
       Lib/test/test_site.py \
       Lib/trace.py \
       Makefile.pre.in \
       Modules/getpath.c \
       setup.py
./configure --prefix=/usr       \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --enable-unicode=ucs4
make
make test
make install
chmod -v 755 /usr/lib32/libpython2.7.so.1.0
mv -v /usr/bin/python{,-64}
mv -v /usr/bin/python2{,-64}
mv -v /usr/bin/python2.7{,-64}
mv -v /usr/include/python2.7/pyconfig{,-64}.h
ln -sfv python2.7-64 /usr/bin/python2-64
ln -sfv python2-64 /usr/bin/python-64
ln -sfv multiarch_wrapper /usr/bin/python &&
ln -sfv multiarch_wrapper /usr/bin/python2 &&
ln -sfv multiarch_wrapper /usr/bin/python2.7

Finally create the pyconfig.h wrapper to select the correct platform header. This is the stub header from CBLFS modified to support x32 ABI:

cat > /usr/include/python2.7/pyconfig.h << `EOF`
/* pyconfig.h - Stub Header  */
#ifndef __STUB__PYCONFIG_H__
#define __STUB__PYCONFIG_H__

#if defined(__x86_64__) || \
    defined(__sparc64__) || \
    defined(__arch64__) || \
    defined(__powerpc64__) || \
    defined (__s390x__)
# if defined (__ILP32__)
#  include `pyconfig-x32.h`
# else
#  include `pyconfig-64.h`
# endif
#else
# include `pyconfig-32.h`
#endif

#endif /* __STUB__PYCONFIG_H__ */
EOF

libxml2

Optional dependency: Python 2 (multilib

First build the 32-bit version:

tar xf ../xmlts20130923.tar.gz
export BUILDENV=32
./configure --prefix=/usr --disable-static --with-history \
--libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install
unset BUILDENV

Next install the x32 ABI version:

make clean
export BUILDENV=x32
./configure --prefix=/usr --disable-static --with-history \
--libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install
unset BUILDENV

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --disable-static --with-history \
            --libdir=/usr/lib
make
make check
make install

libxslt

Dependencies:

libxml2 (multilib)

libgcrypt (multilib)

Python 2 (multilib)

docbook-xml (non-multilib)]

docbook-xsl (non-multilib)]

First build the 32-bit version:

export BUILDENV=32
./configure --prefix=/usr --disable-static \
--libdir=/usr/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install
unset BUILDENV

Next build the x32 ABI version:

make clean
export BUILDENV=x32
./configure --prefix=/usr --disable-static \
--libdir=/usr/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install
unset BUILDENV

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --disable-static
make
make check
make install

Fontconfig

Dependencies:

FreeType (multilib)

Expat (multilib) or libxml2 (multilib)

First install the 32-bit version:

BUILDENV=32 ./configure --prefix=/usr        \
            --sysconfdir=/etc    \
            --localstatedir=/var \
            --docdir=/usr/share/doc/fontconfig-2.11.0 \
            --disable-docs       \
            --disable-static     \
            --libdir=/usr/lib32  \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure --prefix=/usr        \
            --sysconfdir=/etc    \
            --localstatedir=/var \
            --docdir=/usr/share/doc/fontconfig-2.11.0 \
            --disable-docs       \
            --disable-static     \
            --libdir=/usr/libx32  \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install

Finally install the 64-bit version:

make clean
./configure --prefix=/usr        \
            --sysconfdir=/etc    \
            --localstatedir=/var \
            --docdir=/usr/share/doc/fontconfig-2.11.0 \
            --disable-docs       \
            --disable-static
make
make check
make install
install -v -dm755 \
        /usr/share/{man/man{3,5},doc/fontconfig-2.11.0/fontconfig-devel} &&
install -v -m644 fc-*/*.1          /usr/share/man/man1 &&
install -v -m644 doc/*.3           /usr/share/man/man3 &&
install -v -m644 doc/fonts-conf.5  /usr/share/man/man5 &&
install -v -m644 doc/fontconfig-devel/* \
        /usr/share/doc/fontconfig-2.11.0/fontconfig-devel &&
install -v -m644 doc/*.{pdf,sgml,txt,html} \
       /usr/share/doc/fontconfig-2.11.0

GDB

Dependencies:

Lfs-multilib/blfs#Expat Expat (multilib)

First install the 32-bit version:

sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
BUILDENV=32 ./configure --prefix=/usr --disable-werror --libdir=/usr/lib32 \
--build=i686-pc-linux-gnu CC=`gcc -m32` CXX=`g++ -m32`
make
make -k check
make install

Next install the x32 ABI version:

make distclean
BUILDENV=x32 ./configure --prefix=/usr --disable-werror --libdir=/usr/lib32 \
--build=x86_64-unknown-linux-gnux32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make -k check
make install

Finally install the 64-bit version:

make distclean
./configure --prefix=/usr --disable-werror
make
make -k check
make install

LLVM

Dependencies:

libffi (multilib)

Python 2 (multilib)

Zip (non-multilib)

CMake (non-multilib)

CURRENTLY BROKEN - DO NOT USE THESE INSTRUCTIONS OR X11/MESA WILL BREAK

After unpacking the optional packages, first install the 32-bit version:

sed -e 's:\$(PROJ_prefix)/docs/llvm:$(PROJ_prefix)/share/doc/llvm-3.4:' \
    -i Makefile.config.in
mkdir build
cd build
export BUILDENV=32
cmake -DCMAKE_BUILD_TYPE=Release       \
      -DCMAKE_INSTALL_PREFIX=/usr      \
      -DLLVM_LIBDIR_SUFFIX=32          \
      -DLLVM_ENABLE_FFI=ON             \
      -DBUILD_SHARED_LIBS=ON           \
      -DCMAKE_C_FLAGS=-m32             \
      -DCMAKE_CXX_FLAGS=-m32 ..
make
make install
unset BUILDENV

Next install the x32 ABI version:

rm -fr *
export BUILDENV=x32
cmake -DCMAKE_BUILD_TYPE=Release       \
      -DCMAKE_INSTALL_PREFIX=/usr      \
      -DLLVM_LIBDIR_SUFFIX=x32          \
      -DLLVM_ENABLE_FFI=ON             \
      -DBUILD_SHARED_LIBS=ON           \
      -DCMAKE_C_FLAGS=-mx32             \
      -DCMAKE_CXX_FLAGS=-mx32 ..
make
make install
unset BUILDENV

Finally install the 64-bit version:

make clean
CC=gcc CXX=g++                         \
./configure --prefix=/usr              \
            --sysconfdir=/etc          \
            --enable-libffi            \
            --enable-optimized         \
            --enable-shared            \
            --disable-assertions
make
make install
for file in /usr/lib/lib{clang,LLVM,LTO}*.so
do
  test -f $file && chmod -v 644 $file
done

Xorg build environment

If using an XORG_PREFIX other than /usr, use the following command to append the /etc/profile.d/xorg.sh file:

cat >> /etc/profile.d/xorg.sh << `EOF`

pathappend $XORG_PREFIX/bin             PATH
pathappend $XORG_PREFIX/lib/pkgconfig   PKG_CONFIG_PATH
pathappend $XORG_PREFIX/share/pkgconfig PKG_CONFIG_PATH

pathappend $XORG_PREFIX/lib             LIBRARY_PATH
pathappend $XORG_PREFIX/lib32           LIBRARY_PATH
pathappend $XORG_PREFIX/libx32          LIBRARY_PATH
pathappend $XORG_PREFIX/include         C_INCLUDE_PATH
pathappend $XORG_PREFIX/include         CPLUS_INCLUDE_PATH

ACLOCAL='aclocal -I $XORG_PREFIX/share/aclocal'

export PATH PKG_CONFIG_PATH ACLOCAL LIBRARY_PATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH
EOF

And use the following command on /etc/ld.so.conf:

pathappend $XORG_PREFIX/lib             LIBRARY_PATH
pathappend $XORG_PREFIX/lib32           LIBRARY_PATH
pathappend $XORG_PREFIX/libx32          LIBRARY_PATH

libXau

Dependencies:

Xorg Protocol Headers

First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG \
            --libdir=$XORG_PREFIX/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG \
            --libdir=$XORG_PREFIX/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
make check
make install

libXdmcp

Dependencies:

Xorg Protocol Headers

First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG \
            --libdir=$XORG_PREFIX/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG \
            --libdir=$XORG_PREFIX/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
make install

xcb-proto

Dependencies:

Python 2 (multilib) or Python 3 (multilib)

libxml2 (multilib)

First install the 32-bit version:

export BUILDENV=32
./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32
make check
make install
unset BUILDENV

Next install the x32 ABI version:

export BUILDENV=x32
./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32
make check
make install
unset BUILDENV

Finally install the 64-bit version:

./configure $XORG_CONFIG
make check
make install

libxcb

Dependencies:

libXau (multilib)

xcb-proto (multilib)

libXdmcp (multilib)

libxslt (multilib)

Check (multilib)

First build the 32-bit version:

sed -e `s/pthread-stubs//` -i configure.ac
autoreconf -fiv
export BUILDENV=32
./configure $XORG_CONFIG --docdir='${datadir}'/doc/libxcb-1.10 \
            --enable-xinput --enable-xkb --libdir=$XORG_PREFIX/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install
unset BUILDENV

Next install the x32 ABI version:

make clean
export BUILDENV=x32
./configure $XORG_CONFIG --docdir='${datadir}'/doc/libxcb-1.10 \
            --enable-xinput --enable-xkb --libdir=$XORG_PREFIX/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install
unset BUILDENV

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG --docdir='${datadir}'/doc/libxcb-1.10 \
            --enable-xinput --enable-xkb
make
make check
make install


Xorg Libraries

Dependencies:

Fontconfig (multilib)

libxcb (multilib)

xmlto (non-multilib), with dependencies listed on BLFS page for Xorg Libraries

First download the libraries, and set up the build shell per LFS instructions. Next install the 32-bit libraries:

export BUILDENV=32
for package in $(grep -v '^#' ../lib-7.7.md5 | awk '{print $2}')
do
  packagedir=${package%.tar.bz2}
  tar -xf $package
  pushd $packagedir
  case $packagedir in
    libFS-[0-9]* )
      sed -e '/#include <X11/ i\#include <X11\/Xtrans\/Xtransint.h>' \
          -e 's/_FSTransReadv(svr->trans_conn/readv(svr->trans_conn->fd/' \
          -i src/FSlibInt.c
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
                  CC=`gcc -m32` CXX=`g++ -m32`
    ;;
    libXfont-[0-9]* )
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
                  CC=`gcc -m32` CXX=`g++ -m32`
    ;;
    libXft-[0-9]* )
      patch -Np1 -i ../../libXft-2.3.1-freetype_fix-1.patch
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
                  CC=`gcc -m32` CXX=`g++ -m32`
    ;;
    libXt-[0-9]* )
      ./configure $XORG_CONFIG --with-appdefaultdir=/etc/X11/app-defaults \
                  --libdir=$XORG_PREFIX/lib32 \
                  CC=`gcc -m32` CXX=`g++ -m32`
    ;;
    * )
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
                  CC=`gcc -m32` CXX=`g++ -m32`
    ;;
  esac
  make
  as_root make install
  popd
  rm -rf $packagedir
  as_root /sbin/ldconfig
done
unset BUILDENV

Next install the x32 ABI libraries:

export BUILDENV=x32
for package in $(grep -v '^#' ../lib-7.7.md5 | awk '{print $2}')
do
  packagedir=${package%.tar.bz2}
  tar -xf $package
  pushd $packagedir
  case $packagedir in
    libFS-[0-9]* )
      sed -e '/#include <X11/ i\#include <X11\/Xtrans\/Xtransint.h>' \
          -e 's/_FSTransReadv(svr->trans_conn/readv(svr->trans_conn->fd/' \
          -i src/FSlibInt.c
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
                  CC=`gcc -mx32` CXX=`g++ -mx32`
    ;;
    libXfont-[0-9]* )
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
                  CC=`gcc -mx32` CXX=`g++ -mx32`
    ;;
    libXft-[0-9]* )
      patch -Np1 -i ../../libXft-2.3.1-freetype_fix-1.patch
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
                  CC=`gcc -mx32` CXX=`g++ -mx32`
    ;;
    libXt-[0-9]* )
      ./configure $XORG_CONFIG --with-appdefaultdir=/etc/X11/app-defaults \
                  --libdir=$XORG_PREFIX/libx32 \
                  CC=`gcc -mx32` CXX=`g++ -mx32`
    ;;
    * )
      ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
                  CC=`gcc -mx32` CXX=`g++ -mx32`
    ;;
  esac
  make
  as_root make install
  popd
  rm -rf $packagedir
  as_root /sbin/ldconfig
done
unset BUILDENV

Finally install the 64-bit libraries:

for package in $(grep -v '^#' ../lib-7.7.md5 | awk '{print $2}')
do
  packagedir=${package%.tar.bz2}
  tar -xf $package
  pushd $packagedir
  case $packagedir in
    libFS-[0-9]* )
      sed -e '/#include <X11/ i\#include <X11\/Xtrans\/Xtransint.h>' \
          -e 's/_FSTransReadv(svr->trans_conn/readv(svr->trans_conn->fd/' \
          -i src/FSlibInt.c
      ./configure $XORG_CONFIG
    ;;
    libXfont-[0-9]* )
      ./configure $XORG_CONFIG --disable-devel-docs
    ;;
    libXft-[0-9]* )
      patch -Np1 -i ../../libXft-2.3.1-freetype_fix-1.patch
      ./configure $XORG_CONFIG
    ;;
    libXt-[0-9]* )
      ./configure $XORG_CONFIG \
                  --with-appdefaultdir=/etc/X11/app-defaults
    ;;
    * )
      ./configure $XORG_CONFIG
    ;;
  esac
  make
  as_root make install
  popd
  rm -rf $packagedir
  as_root /sbin/ldconfig
done

xcb-util

Dependencies:

lfs-multilib/blfs#libxcb libxcb (multilib)

First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
make install

xcb-util-image

Dependencies:

xcb-util (multilib) First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
LD_LIBRARY_PATH=$XORG_PREFIX/lib32 make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
LD_LIBRARY_PATH=$XORG_PREFIX/libx32 make check
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
LD_LIBRARY_PATH=$XORG_PREFIX/lib make check
make install

xcb-util-keysyms

Dependencies:

xcb-util (multilib) First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
LD_LIBRARY_PATH=$XORG_PREFIX/lib32 make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
LD_LIBRARY_PATH=$XORG_PREFIX/libx32 make check
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
LD_LIBRARY_PATH=$XORG_PREFIX/lib make check
make install

xcb-util-renderutil

Dependencies:

xcb-util (multilib) First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
make install

xcb-util-wm

Dependencies:

xcb-util (multilib) First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/lib32 \
            CC=`gcc -m32` CXX=`g++ -m32`
make
LD_LIBRARY_PATH=$XORG_PREFIX/lib32 make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG --libdir=$XORG_PREFIX/libx32 \
            CC=`gcc -mx32` CXX=`g++ -mx32`
make
LD_LIBRARY_PATH=$XORG_PREFIX/libx32 make check
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
LD_LIBRARY_PATH=$XORG_PREFIX/lib make check
make install

libdrm

Dependencies:

Xorg Libraries (multilib)

Valgrind (multilib)

First install the 32-bit version:

sed -e `/pthread-stubs/d` -i configure.ac
autoreconf -fiv
BUILDENV=32 PKG_CONFIG_PATH=/usr/lib32/pkgconfig \
./configure --prefix=/usr --enable-udev --libdir=/usr/lib32 \
            CC=`gcc -m32` CXX=`gxx -m32` # Add --enable-cairo-tests=no if build fails
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 PKG_CONFIG_PATH=/usr/libx32/pkgconfig \
./configure --prefix=/usr --enable-udev --libdir=/usr/lib32 \
            CC=`gcc -mx32` CXX=`gxx -mx32` # Add --enable-cairo-tests=no if build fails
make
make check
make install

Finally install the 64-bit version:

make clean
./configure --prefix=/usr --enable-udev
make
make check
make install

libvdpau

Dependencies:

Xorg Libraries (multilib)

MesaLib (multilib, runtime)

First build the 32-bit version: First install the 32-bit version:

BUILDENV=32 ./configure $XORG_CONFIG \
            --libdir=$XORG_PREFIX/lib32 CC=`gcc -m32` CXX=`g++ -m32`
make
make check
make install

Next install the x32 ABI version:

make clean
BUILDENV=x32 ./configure $XORG_CONFIG \
            --libdir=$XORG_PREFIX/libx32 CC=`gcc -mx32` CXX=`g++ -mx32`
make
make check
make install

Finally install the 64-bit version:

make clean
./configure $XORG_CONFIG
make
make check
make install