General Compilation Instructions

#### Linux From Scratch - Version r13.0-127-systemd

### Important Preliminary Material

- Prev

  Toolchain Technical Notes

- Next

  Compiling a Cross-Toolchain

- Up
- Home

# iii. General Compilation Instructions

### Caution

During a development cycle of LFS, the instructions in the book are often modified to adapt for a package update or take the advantage of new features from updated packages. Mixing up the instructions of different versions of the LFS book can cause subtle breakages. This kind of issue is generally a result from reusing some script created for a prior LFS release. Such a reuse is strongly discouraged. If you are reusing scripts for a prior LFS release for any reason, you'll need to be very careful to update the scripts to match current version of the LFS book.

Here are some things you should know about building each package:

- Several packages are patched before compilation, but only when the patch is needed to circumvent a problem. A patch is often needed in both the current and the following chapters, but sometimes, when the same package is built more than once, the patch is not needed right away. Therefore, do not be concerned if instructions for a downloaded patch seem to be missing. Warning messages about offset or fuzz may also be encountered when applying a patch. Do not worry about these warnings; the patch was still successfully applied.

- During the compilation of most packages, some warnings will scroll by on the screen. These are normal and can safely be ignored. These warnings are usually about deprecated, but not invalid, use of the C or C++ syntax. C standards change fairly often, and some packages have not yet been updated. This is not a serious problem, but it does cause the warnings to appear.

- Check one last time that the `LFS` environment variable is set up properly:

      echo $LFS

  Make sure the output shows the path to the LFS partition's mount point, which is `/mnt/lfs`, using our example.

- Finally, two important items must be emphasized:

  ### Important

  The build instructions assume that the Host System Requirements, including symbolic links, have been set properly:

  - bash is the shell in use.

  - sh is a symbolic link to bash.

  - /usr/bin/awk is a symbolic link to gawk.

  - /usr/bin/yacc is a symbolic link to bison, or to a small script that executes bison.

  ### Important

  Here is a synopsis of the build process.

  1. Place all the sources and patches in a directory that will be accessible from the chroot environment, such as `/mnt/lfs/sources/`.

  2. Change to the `/mnt/lfs/sources/` directory.

  3. For each package:

     1. Using the tar program, extract the package to be built. In Chapter 5 and Chapter 6, ensure you are the lfs user when extracting the package.

        Do not use any method except the tar command to extract the source code. Notably, using the cp -R command to copy the source code tree somewhere else can destroy timestamps in the source tree, and cause the build to fail.

     2. Change to the directory created when the package was extracted.

     3. Follow the instructions for building the package.

     4. Change back to the sources directory when the build is complete.

     5. Delete the extracted source directory unless instructed otherwise.

- Prev

  Toolchain Technical Notes

- Next

  Compiling a Cross-Toolchain

- Up
- Home