qLinux
… a distribution study
<< Prev Mpc
Next >> Shadow
The patches are similar to GCC-11.2.0 - Pass 2. Replace lib64:
patch -Np0 -i ../_sources/patches/obsolete/0001-pure64-for-x86-64.patch
Apply a patch to reflect the qLinux conventions:
patch -Np1 -i ../_sources/patches/config-gcc.patch
This patch does the following changes:
 /qlnx/inc 
Install the c++ header files from libstdc++-v3 in  /qlnx/inc 
:
patch -Np1 -i ../_sources/patches/gcc-libstdc++-headers-install.patch
Configure gcc:
../configure --prefix=/qlnx \ --enable-languages=c,c++ \ --enable-bootstrap \ --disable-multilib \ --disable-libsanitizer \ --libexecdir=/qlnx/bin/libexec \ --includedir=/qlnx/inc \ --datarootdir=/qlnx/dat \ --localedir=/qlnx/dat/locale \ --mandir=/qlnx/man \ --infodir=/tmp \ --with-system-zlib \ --with-pkgversion=qLinux
–enable-bootstrap
    Build a native compiler.
–disable-libsanitizer
    Musl doesn't support libsanitizer yet (requires the non-existent <fstab.h> from glibc).
–datarootdir=/qlnx/dat
    The datarootdir have to be defined explicitly, otherwise the directory name share will be used (e.g. for locale data).
Libgomp and may be other libs require to have a  sh 
in the path
Compile gcc:
make
Install it:
make install
Remove an obsolete directory:
rm -rf /linux/lib/gcc/$(gcc -dumpmachine)/11.2.0/include-fixed/bits/
Remove python bindings (optional):
rm -rf /linux/dat/gcc-11.2.0
Add a compatibility symlink to enable building programs with Link Time Optimization (LTO):
ln -sfv ../../linux/bin/lib/gcc/$(gcc -dumpmachine)/11.2.0/liblto_plugin.so /linux/lib/bfd-plugins/
Now it's recommendd to verify it works:
echo 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib'
Do the other tests described in the book. : Not all tests are possible.
Optional: Delete the now obsolete folders  /qlnx/bin/libexec/gcc/x86_64-linux-musl 
and  /qlnx/lib/gcc/x86_64-linux-musl 
.
To get the gcc work was a period over more than 5 weeks overall!