Important Information

BLFS has more information regarding compilation, /usr vs /usr/local, boot scripts, etc. at https://linuxfromscratch.org/blfs/view/svn/introduction/important.html. Unlike this book, this would be a chapter in BLFS. A lot of that information has been omitted as this book is more linear and doesn't follow how BLFS follows. However, we will cover some bases here.

Which Instructions to Follow

This book is different from the main LFS and BLFS books as it also has lib32 installation instructions whilst also supporting 32-bit CPUs. This is bound to cause confusion.

When you see Installation of ..., no matter your CPU, those instructions should be followed if you need that package. As you progress, you may come across a different format, and the book will instruct you on what to follow at that point. However, for those who have a x86_64 CPU, you should read Multilib firstly, and second, you will probably have to do more than the normal installation.

This is where the sections labeled lib32 Installation of ... come in. These sections are meant only for those using or targetting a x86_64 CPU as they provide 32-bit libraries for 32-bit software compatibility, ie. multilib support. If you don't need the 32-bit libraries from a given package on x86_64, you may skip the lib32 installation instructions of that package. If you are on a 32-bit CPU, don't bother with those instructions and just follow the normal installation instructions.

Stability

This book is in a constant flux of updates, including packages and can be akin to the BLFS Git version. Right now, there is no stable version of GLFS. This may cause problems when you wish to continue onto BLFS. Sometimes, packages in this book will have newer versions than even BLFS development pages. It is recommended to remember what versions of packages you have on your system because of this. Expect build failures at some point, although we try to limit that possibility.

Init System

This version of this book is meant for SysV LFS systems, but if you find or make your own bootscripts, you can use the instructions in this book on a system that has Runit or OpenRC. The Systemd version of the book is not rendered anywhere by The GLFS Development Team due to Github Pages restraints. Thus you will need to render it yourself. Follow the GLFS rendering instructions in order to render the book yourself. You will need git-2.48.1 to clone the repository.

Building software

Building software on GLFS is identical to how it's done in the BLFS books, along with having lib32 compilation instructions. It goes without saying firstmost that you should have MAKEFLAGS set to save yourself a lot of time. This is useful for the make utility to use the amount of threads that you both want and have.

export MAKEFLAGS='-jx'

Replace x with the amount of threads you have. You can check the amount of threads you have with:

grep processor /proc/cpuinfo
[Important]

Important

Make sure that you have enough RAM for your system! A general method is having 2.5G per thread that is thrown at make. For instance, if you want to use 6 threads, multiply 6 by 2.5 (which is 15), then make sure you have 15G of RAM. If you don't have that RAM, try and limit the threads you throw at make.

Next is compiling for 32-bit. There are many packages which will have a lib32 counterpart. If you just got done with a normal compilation of a package and wish to do a 32-bit compilation of that same package, make sure to clean the directory first:

make distclean

Or, if you made a build directory, do this in the build directory:

rm -rf *

Then proceed with the 32-bit compilation instructions.

Generally, the format of targetting 32-bit goes like this:

For ./configure:

CC="gcc -m32" CXX="g++ -m32"                  \
PKG_CONFIG_PATH=/usr/lib32/pkgconfig          \
./configure --prefix=/usr --libdir=/usr/lib32 \
            --host=i686-pc-linux-gnu &&

make &&

make DESTDIR=$PWD/DESTDIR install     &&
cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR                        &&
ldconfig

For meson:

mkdir -v build &&
cd       build &&

CC="gcc -m32" CXX="g++ -m32"                     \
PKG_CONFIG_PATH=/usr/lib32/pkgconfig             \
meson setup .. --prefix=/usr --libdir=/usr/lib32 &&

ninja &&

DESTDIR=$PWD/DESTDIR ninja install    &&
cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR                        &&
ldconfig

For cmake:

mkdir -v build &&
cd       build &&

CC="gcc -m32" CXX="g++ -m32"           \
PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr   \
         -DCMAKE_INSTALL_LIBDIR=lib32 &&

make &&

make DESTDIR=$PWD/DESTDIR install     &&
cp -vr DESTDIR/usr/lib32/* /usr/lib32 &&
rm -rf DESTDIR                        &&
ldconfig
[Note]

Note

After you do a DESTDIR installation, it is recommended to to use file on one of the libraries in DESTDIR/usr/lib32. An output of such a command for a 32-bit build of a library should be comparable to the following:

ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked

Note the 32-bit LSB shared object part. A 64-bit library would show as a 64-bit LSB shared object.