3.17. Gcc-15.2.0 Pass 2

The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.

Package Information

GCC-pass2 Dependencies

Required

Xz-5.8.3, GCC-15.2.0-pass1, Binutils-2.46.0-pass2, glibc-2.43, and Linux-7.0.3-headers

3.17.1. Installation of GCC-pass2

Prepare GCC-pass2 for compilation:

tar -xf ../gmp-6.3.0.tar.xz && mv -v gmp-6.3.0 gmp
tar -xf ../mpc-1.4.0.tar.xz && mv -v mpc-1.4.0 mpc
tar -xf ../mpfr-4.2.2.tar.xz && mv -v mpfr-4.2.2 mpfr

case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
  ;;
esac
sed '/thread_header =/s/@.*@/gthr-posix.h/' -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in

Now Configure the Package, issue:

mkdir -v build
cd build
../configure --prefix=/usr \
             --host=$LFS_TGT \
             --target=$LFS_TGT \
             --build=$(../config.guess) \
             --with-build-sysroot=$LFS \
             --enable-default-pie \
             --enable-default-ssp \
             --disable-nls \
             --disable-multilib \
             --disable-libatomic \
             --disable-libgomp \
             --disable-libquadmath \
             --disable-libsanitizer \
             --disable-libssp \
             --disable-libvtv \
             --enable-languages=c,c++ \
             LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc

To Compile the Package, issue:

make

Now Install the Package, issue:

make DESTDIR=$LFS install
ln -sv gcc $LFS/usr/bin/cc

3.17.2. Contents of GCC-pass2

Installed programs: PROGRAMS
Installed libraries: LIBRARIES
Installed directories: DIRECTORIES