Crappy error

touch: impossibile fare touch di '/storage/denis/lfs/out/arm-lfs-linux-gnueabi/rootfs/usr/include/gnu/stubs.h': File o directory non esistente
Error in file: ./build.sh, line: 256, reason: Command exited with status 1
This commit is contained in:
Denis Benato 2024-12-07 03:49:25 +01:00
parent 39614b7d65
commit c9f25de0d0
2 changed files with 421 additions and 120 deletions

342
build.sh
View file

@ -32,7 +32,11 @@ if [ -z "$ARCH" ]; then
fi
if [ -z "$LFS_TGT" ]; then
export LFS_TGT="$ARCH-lfs-linux-gnu"
if [ -z "$GNUEABI" ]; then
export GNUEABI="gnu"
fi
export LFS_TGT="$ARCH-lfs-linux-$GNUEABI"
echo "Target triplet set to '$LFS_TGT'. You can specify another one with the LFS_TGT env var."
fi
@ -102,75 +106,29 @@ if [ ! -f "$STEPS_DIR/binutils" ]; then
--prefix=$LFS_TOOLS \
--with-sysroot=$LFS \
--target=$LFS_TGT \
--with-gnu-as \
--with-gnu-ld \
--enable-ld=default \
--enable-shared \
--disable-nls \
--enable-gprofng=no \
--disable-werror \
--enable-new-dtags \
--disable-multilib \
--disable-libquadmath \
--disable-libquadmath-support \
--enable-plugins \
--enable-deterministic-archives \
--enable-default-hash-style=gnu
make configure-host
#make configure-host
make -j 32
make install
make -j 32 install
cd "$BASE_DIR"
rm -rf binutils-2.43
#rm -rf "$LFS_BUILD/binutils"
touch "$STEPS_DIR/binutils"
fi
# Build gcc
if [ ! -f "$STEPS_DIR/gcc" ]; then
if [ ! -d "$LFS_BUILD/gcc" ]; then
tar -xzf "$BASE_DIR/sources/gcc-14.2.0.tar.gz"
mv "gcc-14.2.0" "$LFS_BUILD/gcc"
fi
cd "$LFS_BUILD/gcc/"
tar -xf "$BASE_DIR/sources/mpfr-4.2.1.tar.xz"
mv -v mpfr-4.2.1 mpfr
tar -xf "$BASE_DIR/sources/gmp-6.3.0.tar.xz"
mv -v gmp-6.3.0 gmp
tar -xf "$BASE_DIR/sources/mpc-1.3.1.tar.gz"
mv -v mpc-1.3.1 mpc
# On x86_64 hosts, set the default directory name for 64-bit libraries to “lib”
case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac
mkdir -vp build
cd build
"../configure" \
--target=$LFS_TGT \
--prefix=$LFS_TOOLS \
--with-glibc-version=2.40 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--disable-decimal-float \
--disable-multilib \
--enable-languages=c,c++
make -j 32 # if build fails add --disable-libsanitizer
make install
cd "$BASE_DIR"
rm -rf "$LFS_BUILD/gcc/build" # Do not remove the whole gcc directory: we need it for libstdc++
touch "$STEPS_DIR/gcc"
fi
# Install kernel headers
if [ ! -f "$STEPS_DIR/linux-headers" ]; then
if [ ! -d "$LFS_BUILD/linux" ]; then
@ -179,12 +137,73 @@ if [ ! -f "$STEPS_DIR/linux-headers" ]; then
fi
cd "$LFS_BUILD/linux"
make mrproper
LD="$LFS_TGT-ld" CC="$LFS_TGT-gcc" CXX="$LFS_TGT-g++" AR="$LFS_TGT-ar" RANLIB="$LFS_TGT-ranlib" make headers_install ARCH="$ARCH" INSTALL_HDR_PATH="$LFS/usr"
make headers_install ARCH="$ARCH" INSTALL_HDR_PATH="$LFS/usr"
cd "$BASE_DIR"
rm -rf "$LFS_BUILD/linux"
#rm -rf "$LFS_BUILD/linux"
touch "$STEPS_DIR/linux-headers"
fi
# Build gcc
if [ ! -f "$STEPS_DIR/gcc-step1" ]; then
bash unpack-gcc.sh
cd "$LFS_BUILD/gcc/"
# # On x86_64 hosts, set the default directory name for 64-bit libraries to “lib”
# case $(uname -m) in
# x86_64)
# sed -e '/m64=/s/lib64/lib/' \
# -i.orig gcc/config/i386/t-linux64
# ;;
# esac
mkdir -vp build
cd build
"../configure" \
--target=$LFS_TGT \
--host=$(../config.guess) \
--build=$(../config.guess) \
--prefix=$LFS_TOOLS \
--with-glibc-version=2.40 \
--with-sysroot=$LFS \
--disable-shared \
--without-headers \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-multilib \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libquadmath-support \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--disable-decimal-float \
--disable-multilib \
--enable-languages=c,c++
make -j 32 all-gcc # if build fails add --disable-libsanitizer
make -j 32 install-gcc
cd "$BASE_DIR"
#rm -rf "$LFS_BUILD/gcc/build" # Do not remove the whole gcc directory: we need it for libstdc++
touch "$STEPS_DIR/gcc-step1"
fi
# From now on use
export BUILD_CC=gcc
export CC="$LFS_TGT-gcc"
export CXX="$LFS_TGT-g++"
export AS="$LFS_TGT-as"
export LD="$LFS_TGT-ld"
export AR="$LFS_TGT-ar"
export RANLIB="$LFS_TGT-ranlib"
# remove hardening options for building libraries
export CFLAGS="-U_FORTIFY_SOURCE -O2"
export CPPFLAGS="-U_FORTIFY_SOURCE -O2"
export LD_LIBRARY_PATH_old="$LD_LIBRARY_PATH"
unset LD_LIBRARY_PATH
# build glibc
if [ ! -f "$STEPS_DIR/glibc" ]; then
if [ ! -d "$LFS_BUILD/glibc" ]; then
@ -197,26 +216,136 @@ if [ ! -f "$STEPS_DIR/glibc" ]; then
cd build
echo "rootsbindir=/usr/sbin" > configparms
echo 'slibdir=/lib' >> configparms
echo 'rtlddir=/lib' >> configparms
echo 'sbindir=/bin' >> configparms
echo 'build-programs=no' >> configparms
"../configure" \
--prefix=/usr \
--prefix=$LFS_TOOLS \
--target=$LFS_TGT \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=4.19 \
--with-headers=$LFS/usr/include \
--with-binutils=$LFS_TOOLS/bin \
--without-cvs \
--disable-nls \
--disable-sanity-checks \
--enable-kernel=4.19 \
--disable-debug \
--disable-profile \
--without-selinux \
--without-gd \
--disable-nscd \
libc_cv_slibdir=/usr/lib
make -j 32
make DESTDIR=$LFS install
sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd
--enable-hacker-mode \
libc_cv_slibdir=/usr/lib \
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes
make install-bootstrap-headers=yes install_root=$LFS install-headers
make -j4 csu/subdir_lib
install csu/crt1.o csu/crti.o csu/crtn.o $LFS/usr/lib
$LFS_TGT-gcc \
-nostdlib \
-nostartfiles \
-shared \
-x c /dev/null \
-o $LFS/usr/lib/libc.so
touch $LFS/usr/include/gnu/stubs.h
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH_old"
#make DESTDIR=$LFS install
#make install_root="$pkgdir"/usr/$_target install
#sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd
cd "$BASE_DIR"
rm -rf "$LFS_BUILD/glibc"
#rm -rf "$LFS_BUILD/glibc"
touch "$STEPS_DIR/glibc"
fi
if [ ! -f "$STEPS_DIR/gcc-step2" ]; then
if [ ! -d "$LFS_BUILD/gcc/build" ]; then
echo "'$LFS_BUILD/gcc/build' directory is supposed to exist. Error."
exit 1
fi
cd "$LFS_BUILD/gcc/build"
# # On x86_64 hosts, set the default directory name for 64-bit libraries to “lib”
# case $(uname -m) in
# x86_64)
# sed -e '/m64=/s/lib64/lib/' \
# -i.orig gcc/config/i386/t-linux64
# ;;
# esac
# ../configure is already done
"../configure" \
--target=$LFS_TGT \
--host=$(../config.guess) \
--build=$(../config.guess) \
--prefix=$LFS_TOOLS \
--with-glibc-version=2.40 \
--with-sysroot=$LFS \
--without-headers \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-multilib \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libquadmath-support \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--disable-decimal-float \
--disable-multilib \
--enable-languages=c,c++
make -j 32 all-target-libgcc # if build fails add --disable-libsanitizer
make -j 32 install-target-libgcc
cd "$BASE_DIR"
#rm -rf "$LFS_BUILD/gcc/build" # Do not remove the whole gcc directory: we need it for libstdc++
touch "$STEPS_DIR/gcc-step2"
fi
if [ ! -f "$STEPS_DIR/glibc-step2" ]; then
if [ ! -d "$LFS_BUILD/glibc/build" ]; then
echo "'$LFS_BUILD/glibc/build' is supposed to exist. Error."
exit 1
fi
cd "$LFS_BUILD/glibc/build"
# Configuration is done already
make -j 32
make install_root=$LFS install
cd "$BASE_DIR"
#rm -rf "$LFS_BUILD/glibc"
touch "$STEPS_DIR/glibc-step2"
fi
# build libstdc++
if [ ! -f "$STEPS_DIR/gcc-step3" ]; then
if [ ! -d "$LFS_BUILD/gcc/build" ]; then
echo "'$LFS_BUILD/gcc/build' directory is supposed to exist. Error."
exit 1
fi
cd "$LFS_BUILD/gcc/build"
make -j 32
make install
cd "$BASE_DIR"
#rm -rf "$LFS_BUILD/gcc"
touch "$STEPS_DIR/gcc-step3"
fi
# test the cross toolchain
which -- $LFS_TGT-as || echo $LFS_TGT-as is not in the PATH
echo 'int main(){}' | "$LFS_TGT-gcc" -xc -
@ -224,56 +353,29 @@ echo 'int main(){}' | "$LFS_TGT-gcc" -xc -
cat test_compiler | grep ld-linux
rm -v a.out test_compiler
# build libstdc++
if [ ! -f "$STEPS_DIR/libstdcxx" ]; then
bash unpack-gcc.sh
cd "$LFS_BUILD/gcc"
mkdir -vp build_libstdcxx
cd build_libstdcxx
#PATH="$PATH:$LFS_TOOLS/bin" RANLIB="$LFS_TOOLS/bin/$LFS_TGT-ranlib" AR="$LFS_TOOLS/bin/$LFS_TGT-ar" LD="$LFS_TOOLS/bin/$LFS_TGT-ld" CC="$LFS_TOOLS/bin/$LFS_TGT-gcc" CXX="$LFS_TOOLS/bin/$LFS_TGT-g++"
bash \
../libstdc++-v3/configure \
--host=$LFS_TGT \
--build=$(../config.guess) \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/14.2.0
make -j 32
make DESTDIR=$LFS install
# Remove the libtool archive files because they are harmful for cross-compilation
rm -v $LFS/usr/lib/lib{stdc++{,exp,fs},supc++}.la
cd "$BASE_DIR"
rm -rf "$LFS_BUILD/gcc"
touch "$STEPS_DIR/libstdcxx"
fi
# build m4
if [ ! -f "$STEPS_DIR/m4" ]; then
if [ ! -d "$LFS_BUILD/m4" ]; then
tar -xzf "$BASE_DIR/sources/m4-1.4.19.tar.gz"
mv "m4-1.4.19" "$LFS_BUILD/m4"
fi
cd "$LFS_BUILD/m4"
#mkdir -vp build
#cd build
echo "rootsbindir=/usr/sbin" > configparms
"./configure" \
--prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
make -j 32
make DESTDIR=$LFS install
cd "$BASE_DIR"
rm -rf "$LFS_BUILD/m4"
touch "$STEPS_DIR/m4"
fi
#if [ ! -f "$STEPS_DIR/m4" ]; then
# if [ ! -d "$LFS_BUILD/m4" ]; then
# tar -xzf "$BASE_DIR/sources/m4-1.4.19.tar.gz"
# mv "m4-1.4.19" "$LFS_BUILD/m4"
# fi
# cd "$LFS_BUILD/m4"
#
# #mkdir -vp build
# #cd build
#
# echo "rootsbindir=/usr/sbin" > configparms
#
# "./configure" \
# --prefix=/usr \
# --target=$LFS_TGT \
# --host=$(build-aux/config.guess) \
# --build=$(build-aux/config.guess) \
#
# make -j 32
# make DESTDIR=$LFS install
#
# cd "$BASE_DIR"
# rm -rf "$LFS_BUILD/m4"
# touch "$STEPS_DIR/m4"
#fi

199
triplets_list.txt Normal file
View file

@ -0,0 +1,199 @@
aarch64-apple-darwin
aarch64-apple-ios
aarch64-apple-ios-macabi
aarch64-apple-ios-sim
aarch64-apple-tvos
aarch64-apple-watchos-sim
aarch64-fuchsia
aarch64-kmc-solid_asp3
aarch64-linux-android
aarch64-nintendo-switch-freestanding
aarch64-pc-windows-gnullvm
aarch64-pc-windows-msvc
aarch64-unknown-freebsd
aarch64-unknown-fuchsia
aarch64-unknown-hermit
aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu_ilp32
aarch64-unknown-linux-musl
aarch64-unknown-netbsd
aarch64-unknown-none
aarch64-unknown-none-softfloat
aarch64-unknown-nto-qnx710
aarch64-unknown-openbsd
aarch64-unknown-redox
aarch64-unknown-uefi
aarch64-uwp-windows-msvc
aarch64-wrs-vxworks
aarch64_be-unknown-linux-gnu
aarch64_be-unknown-linux-gnu_ilp32
arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
arm64_32-apple-watchos
armeb-unknown-linux-gnueabi
armebv7r-none-eabi
armebv7r-none-eabihf
armv4t-none-eabi
armv4t-unknown-linux-gnueabi
armv5te-none-eabi
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv5te-unknown-linux-uclibceabi
armv6-unknown-freebsd
armv6-unknown-netbsd-eabihf
armv6k-nintendo-3ds
armv7-apple-ios
armv7-linux-androideabi
armv7-sony-vita-newlibeabihf
armv7-unknown-freebsd
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7-unknown-linux-uclibceabi
armv7-unknown-linux-uclibceabihf
armv7-unknown-netbsd-eabihf
armv7-wrs-vxworks-eabihf
armv7a-kmc-solid_asp3-eabi
armv7a-kmc-solid_asp3-eabihf
armv7a-none-eabi
armv7a-none-eabihf
armv7k-apple-watchos
armv7r-none-eabi
armv7r-none-eabihf
armv7s-apple-ios
asmjs-unknown-emscripten
avr-unknown-gnu-atmega328
bpfeb-unknown-none
bpfel-unknown-none
hexagon-unknown-linux-musl
i386-apple-ios
i586-pc-windows-msvc
i586-unknown-linux-gnu
i586-unknown-linux-musl
i686-apple-darwin
i686-linux-android
i686-pc-windows-gnu
i686-pc-windows-msvc
i686-unknown-freebsd
i686-unknown-haiku
i686-unknown-linux-gnu
i686-unknown-linux-musl
i686-unknown-netbsd
i686-unknown-openbsd
i686-unknown-uefi
i686-uwp-windows-gnu
i686-uwp-windows-msvc
i686-wrs-vxworks
m68k-unknown-linux-gnu
mips-unknown-linux-gnu
mips-unknown-linux-musl
mips-unknown-linux-uclibc
mips64-openwrt-linux-musl
mips64-unknown-linux-gnuabi64
mips64-unknown-linux-muslabi64
mips64el-unknown-linux-gnuabi64
mips64el-unknown-linux-muslabi64
mipsel-sony-psp
mipsel-sony-psx
mipsel-unknown-linux-gnu
mipsel-unknown-linux-musl
mipsel-unknown-linux-uclibc
mipsel-unknown-none
mipsisa32r6-unknown-linux-gnu
mipsisa32r6el-unknown-linux-gnu
mipsisa64r6-unknown-linux-gnuabi64
mipsisa64r6el-unknown-linux-gnuabi64
msp430-none-elf
nvptx64-nvidia-cuda
powerpc-unknown-freebsd
powerpc-unknown-linux-gnu
powerpc-unknown-linux-gnuspe
powerpc-unknown-linux-musl
powerpc-unknown-netbsd
powerpc-unknown-openbsd
powerpc-wrs-vxworks
powerpc-wrs-vxworks-spe
powerpc64-ibm-aix
powerpc64-unknown-freebsd
powerpc64-unknown-linux-gnu
powerpc64-unknown-linux-musl
powerpc64-unknown-openbsd
powerpc64-wrs-vxworks
powerpc64le-unknown-freebsd
powerpc64le-unknown-linux-gnu
powerpc64le-unknown-linux-musl
riscv32gc-unknown-linux-gnu
riscv32gc-unknown-linux-musl
riscv32i-unknown-none-elf
riscv32im-unknown-none-elf
riscv32imac-unknown-none-elf
riscv32imac-unknown-xous-elf
riscv32imc-esp-espidf
riscv32imc-unknown-none-elf
riscv64gc-unknown-freebsd
riscv64gc-unknown-linux-gnu
riscv64gc-unknown-linux-musl
riscv64gc-unknown-none-elf
riscv64gc-unknown-openbsd
riscv64imac-unknown-none-elf
s390x-unknown-linux-gnu
s390x-unknown-linux-musl
sparc-unknown-linux-gnu
sparc64-unknown-linux-gnu
sparc64-unknown-netbsd
sparc64-unknown-openbsd
sparcv9-sun-solaris
thumbv4t-none-eabi
thumbv5te-none-eabi
thumbv6m-none-eabi
thumbv7a-pc-windows-msvc
thumbv7a-uwp-windows-msvc
thumbv7em-none-eabi
thumbv7em-none-eabihf
thumbv7m-none-eabi
thumbv7neon-linux-androideabi
thumbv7neon-unknown-linux-gnueabihf
thumbv7neon-unknown-linux-musleabihf
thumbv8m.base-none-eabi
thumbv8m.main-none-eabi
thumbv8m.main-none-eabihf
wasm32-unknown-emscripten
wasm32-unknown-unknown
wasm32-wasi
wasm64-unknown-unknown
x86_64-apple-darwin
x86_64-apple-ios
x86_64-apple-ios-macabi
x86_64-apple-tvos
x86_64-apple-watchos-sim
x86_64-fortanix-unknown-sgx
x86_64-fuchsia
x86_64-linux-android
x86_64-pc-nto-qnx710
x86_64-pc-solaris
x86_64-pc-windows-gnu
x86_64-pc-windows-gnullvm
x86_64-pc-windows-msvc
x86_64-sun-solaris
x86_64-unknown-dragonfly
x86_64-unknown-freebsd
x86_64-unknown-fuchsia
x86_64-unknown-haiku
x86_64-unknown-hermit
x86_64-unknown-illumos
x86_64-unknown-l4re-uclibc
x86_64-unknown-linux-gnu
x86_64-unknown-linux-gnux32
x86_64-unknown-linux-musl
x86_64-unknown-netbsd
x86_64-unknown-none
x86_64-unknown-openbsd
x86_64-unknown-redox
x86_64-unknown-uefi
x86_64-uwp-windows-gnu
x86_64-uwp-windows-msvc
x86_64-wrs-vxworks