User Tools

Site Tools


qLinux
… a distribution study


<< Prev
Temporary Tools Intro

Next >>
Prepare the Chroot Environment


Build Temporary Tools Part I

The commands are similar to the book for the packages in chapter 6. Slightly differences are mentioned in the former Temporary Tools Intro. More or less major differences are described below. If not otherwise stated the package will be compiled with  make  and installed with  make install .

Packages of the Book

        M4-1.4.19
        Ncurses-6.2
        Bash-5.1.8
        Coreutils-8.32
        Diffutils-3.8
        File-5.40
        Findutils-4.8.0
        Gawk-5.1.0
        Grep-3.7
        Gzip-1.10
        Make-4.3
        Patch-2.7.6
        Sed-4.8
        Tar-1.34
        Xz-5.2.5
        Binutils-2.37 - Pass 2
        GCC-11.2.0 - Pass 2

M4-1.4.19

Reference: 6.2. M4-1.4.19

./configure --prefix=/qlnx   \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess)
            --mandir=/qlnx/man \
            --infodir=/tmp

Ncurses-6.2

Reference: 6.3 Ncurses-6.2. The special build instructions for the tic program in the book can be ignored safely. It is ok here to use the one from the host. This is the modified  configure  command:

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(./config.guess) \
            --includedir=/qlnx/inc \
            --datarootdir=/qlnx/dat \
            --mandir=/qlnx/man \
            --with-manpage-format=normal \
            --with-shared \
            --without-debug \
            --without-ada \
            --without-normal \
            --enable-widec

Compile and install the package:

$> make
$> make TIC_PATH=/usr/bin/tic install
$> echo "INPUT(-lncursesw)" > $LFS/qlnx/lib/libncurses.so

The above is correct. We use the  tic  from the host.

Bash-5.1.8

Reference: 6.4 Bash-5.1.8. The configure command is slightlyy modified to reflect the final locations:

./configure --prefix=/qlnx \
            --build=$(support/config.guess) \
            --host=$LFS_TGT \
            --without-bash-malloc \
            --includedir=/qlnx/inc \
            --datarootdir=/qlnx/dat \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp \
            --docdir=$LFS/tmp

Create symlinks1):

$> cd $LFS
$> mkdir $LFS/bin
$> ln -s bash bin/sh
$> ln -s bash /qlnx/bin/sh

The sh symlinks are required for the build inside the chroot environment. Delete the empty share directory:

rmdir /qlnx/share

Coreutils-8.32

Reference: 6.5 Coreutils-8.32. Ignore the last step moving chroot and the man pages. The configure command is slightly modified:

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess) \
            --enable-install-program=hostname \
            --enable-no-install-program=kill,uptime \
            --libexecdir=/qlnx/bin/libexec \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Diffutils-3.8

Reference: 6.6. Diffutils-3.8.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

File-5.40

Reference: 6.7 File-5.40. Ignore the first step to build the same magic file as at the host. Run the following command to install 'magic.mgc' directly in  /qlnx/dat  instead of  /qlnx/dat/misc :

sed -i '/^pkgdatadir/s/\/misc//g' configure

Configure, compile and install the package:

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(./config.guess) \
            --includedir=/qlnx/inc \
            --datarootdir=/qlnx/dat \
            --mandir=/qlnx/man

Findutils-4.8.0

Reference: 6.8 Findutils-4.8.0.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess) \
            --includedir=/qlnx/inc \
            --libexecdir=/qlnx/bin/libexec \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Gawk-5.1.0

Reference: 6.9 Gawk-5.1.0.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(./config.guess) \
            --includedir=/qlnx/inc \
            --libexecdir=/qlnx/bin/libexec \
            --datarootdir=/qlnx/dat \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Grep-3.7

Reference: 6.10. Grep-3.7.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Gzip-1.10

Reference: 6.11. Gzip-1.10.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Make-4.3

Reference: 6.12. Make-4.3.

./configure --prefix=/qlnx \
            --without-guile \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess) \
            --includedir=/qlnx/inc \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Patch-2.7.6

Reference: 6.13. Patch-2.7.6.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess) \
            --mandir=/qlnx/man

Sed-4.8

Reference: 6.14. Sed-4.8.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Tar-1.34

Reference: 6.15. Tar-1.34.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess) \
            --includedir=/qlnx/inc \
            --libexecdir=/qlnx/bin/libexec \
            --datarootdir=/qlnx/dat \
            --mandir=/qlnx/man \
            --infodir=$LFS/tmp

Xz-5.2.5

Reference: 6.16. Xz-5.2.5.

./configure --prefix=/qlnx \
            --host=$LFS_TGT \
            --build=$(build-aux/config.guess) \
            --disable-static \
            --includedir=/qlnx/inc \
            --datarootdir=/qlnx/dat \
            --mandir=/qlnx/man \
            --docdir=$LFS/tmp

Binutils-2.37 - Pass 2

Reference: 6.17 Binutils-2.37 - Pass 2. Apply a patch to change the default library path to  /qlnx/lib :

 patch -Np1 -i ../_sources/patches/binutils-default-lib.patch

This ensures that the crt*.o files will be found by the linker (ld).

../configure --prefix=/qlnx \
             --build=$(../config.guess) \
             --host=$LFS_TGT \
             --disable-nls \
             --enable-shared \
             --disable-werror \
             --enable-64-bit-bfd \
             --includedir=/qlnx/inc \
             --datarootdir=/qlnx/dat \
             --mandir=/qlnx/man \
             --infodir=$LFS/tmp

In qLinux the target triplet is in  /qlnx/lib/binutils . This have to be fixed in the new created  build/Makefile :

sed -i '/^tooldir/s/}\/x86_/}\/lib\/binutils\/x86_/g' Makefile
sed -i '/^build_tooldir/s/}\/x86_/}\/lib\/binutils\/x86_/g' Makefile

Compile and install the package:

$> make
$> make install -j1

The workaround from the book to install libctf.so was not required. The book says to do the following command:

$> install -vm755 libctf/.libs/libctf.so.0.0.0 [$LFS]/qlnx/lib

Against the above command does link the libctf with an invalid path to other libraries. To verify that it is linked correct do

ldd /qlnx/lib/libcft.so*

Everything have to be linked to libraries in  /qlnx/lib/* .

GCC-11.2.0 - Pass 2

Reference: 6.18. GCC-11.2.0 - Pass 2.

Important: Start with a fresh extracted sources from the tarball always!

Extract the mpfr, mpc and gmp packages into the source tree. Replace the lib64 (patch FIXME):

patch -Np0 -i ../_sources/_patches/0001-pure64-for-x86-64.patch

The book suggests a sed command for this, but the patch is more strict.

Change the default (native) include directory (patch FIXME) to  /qlnx/inc , the location of the dynamic loader and the startfile prefix:

patch -Np1 -i ../_sources/_patches/config-gcc-qlinux.patch

On some systems the compilation could fail with an error saying that  fenv.h  (and many other headers) was not found. In this case apply the following patch as a workaround:

patch -Np1 -i ../_sources/patches/gcc-nostinc++.patch

Start over an interrupted build of gcc from fresh extracted sources.

Enable posix threads support in libgcc:

mkdir -pv $LFS_TGT/libgcc
ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h

In the build directory configure the package:

../configure --prefix=/qlnx \
             --build=$(../config.guess) \
             --host=$LFS_TGT \
             CC_FOR_TARGET=$LFS_TGT-gcc \
             CXX_FOR_TARGET=$LFS_TGT-g++ \
             --with-tune=generic \
             --with-arch=x86-64 \
             --enable-languages=c,c++ \
             --disable-bootstrap \
             --enable-initfini-array \
             --disable-multilib \
             --disable-libsanitizer \
             --disable-werror \
             --libexecdir=/qlnx/bin/libexec \
             --includedir=/qlnx/inc \
             --datarootdir=/qlnx/dat \
             --mandir=/qlnx/man \
             --infodir=$LFS/tmp

The build steps are different from the book, instead it's done the “mussel way”. First the gcc itself:

make all-gcc

Before continue check that the dynamic loader is correct:

readelf -l gcc/cc1 | grep ld

Install it:

make install-gcc

Build an install libgcc make -C $LFS_TGT/libgcc distclean make enable-shared=yes all-target-libgcc make install-target-libgcc </code>

Build libstdc++-v3 for c++ support:

make all-target-libstdc++-v3
make install-target-libstdc++-v3

Optional build OpenMP support (libgomp):

make all-target-libgomp
make install-target-libgomp

Verify that all works like expected:

gcc dummy.c

Check for the correct dynamic loader.

readelf -l a.out | grep ld

Execute the  a.out   file:

./a.out

There should be no output as well no error. Do the same for c++. First create a c++ testfile:

cat > dummy.cpp << "EOF"
#include<iostream>
int main(int argc, char** argv) {
  using namespace std;
  int ret = 0;
  return ret;
}
EOF

Compile it:

g++ dummy.cpp -o cpp.out

and repeat the last to steps with  cpp.out  file like with  a.out  from above.


<< Prev
Temporary Tools Intro

        

Next >>
Prepare the Chroot Environment

1)
this is a temporary workaround, because we do not fix the build system of the temporary tools