I'm on 6.18 of LFS.
https://linuxfromscratch.org/lfs/view/stable-systemd/chapter06/gcc-pass2.html
But I keep getting the error below.
g++ -fno-PIE -c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include -I../.././gcc/../libcody -I/mnt/lfs/sources/gcc-12.2.0/host-x86_64-lfs-linux-gnu/gmp -I/mnt/lfs/sources/gcc-12.2.0/gmp -I/mnt/lfs/sources/gcc-12.2.0/host-x86_64-lfs-linux-gnu/mpfr/src -I/mnt/lfs/sources/gcc-12.2.0/mpfr/src -I/mnt/lfs/sources/gcc-12.2.0/mpc/src -I../.././gcc/../libdecnumber -I../.././gcc/../libdecnumber/dpd -I../libdecnumber -I../.././gcc/../libbacktrace -o insn-recog.o -MT insn-recog.o -MMD -MP -MF ./.deps/insn-recog.TPo insn-recog.cc
x86_64-lfs-linux-gnu-gcc -dumpspecs > tmp-specs
/bin/sh: line 1: x86_64-lfs-linux-gnu-gcc: command not found
make[2]: *** [Makefile:2185: specs] Error 127
make[2]: *** Waiting for unfinished jobs....
rm gcc.pod
make[2]: Leaving directory '/mnt/lfs/sources/gcc-12.2.0/host-x86_64-lfs-linux-gnu/gcc'
make[1]: *** [Makefile:4621: all-gcc] Error 2
make[1]: Leaving directory '/mnt/lfs/sources/gcc-12.2.0'
make: *** [Makefile:1036: all] Error 2
Im using this function to build:
function gcc2() {
export BUILD_DIR=/mnt/lfs/sources ## This si usualy at top of file but added it for this examples sake.
#https://linuxfromscratch.org/lfs/view/stable-systemd/chapter06/gzip.html
cd $BUILD_DIR && tar -vxkf gcc-12.2.0.tar.xz && cd gcc-12.2.0
$BUILD_DIR/gcc-12.2.0/contrib/download_prerequisites
rm -rf $BUILD_DIR/gcc-12.2.0/isl*
case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' -i.orig $BUILD_DIR/gcc-12.2.0/gcc/config/i386/t-linux64
;;
esac
sed '/thread_header =/s/@.*@/gthr-posix.h/' -i $BUILD_DIR/gcc-12.2.0/libgcc/Makefile.in libstdc++-v3/include/Makefile.in
if ! [[ -d "$BUILD_DIR/gcc-12.2.0/build" ]]; then
mkdir $BUILD_DIR/gcc-12.2.0/build && cd $BUILD_DIR/gcc-12.2.0/build
fi
$BUILD_DIR/gcc-12.2.0/build/../configure --build=$(../config.guess) --host=$LFS_TGT --target=$LFS_TGT LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc --prefix=/usr --with-build-sysroot=$LFS --enable-initfini-array --disable-nls --disable-multilib --disable-decimal-float --disable-libatomic --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --enable-languages=c,c++
make && make DESTDIR=$LFS install && ln -sv gcc $LFS/usr/bin/cc
}
My env looks like this:
lfs:/mnt/lfs/sources/gcc-12.2.0$ env
PWD=/mnt/lfs/sources/gcc-12.2.0
HOME=/home/lfs
MAKEFLAGS=-j8
TERM=screen
SHLVL=1
PS1=\u:\w\$
LFS_TGT=x86_64-lfs-linux-gnu
LC_ALL=POSIX
LFS=/mnt/lfs
CONFIG_SITE=/mnt/lfs/usr/share/config.site
PATH=/mnt/lfs/tools/bin:/usr/bin
_=/usr/bin/env
OLDPWD=/mnt/lfs/sources/gcc-12.2.0/build
lfs:/mnt/lfs/sources/gcc-12.2.0$
I don't understand why its failing. Where have I gone wrong?