[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
howtos:hardware:arm:gcc-13.x_aarch64_cross-compiler [2023/10/19 10:17 (UTC)] – [AArch64 cross-compiler script code] modify script code to build --with-sysroot exagahowtos:hardware:arm:gcc-13.x_aarch64_cross-compiler [2024/02/08 07:55 (UTC)] – [AArch64 cross-compiler script code] revised/updated script code exaga
Line 38: Line 38:
  
 ############################################################################## ##############################################################################
-# Slackware ARM gcc-13.2.0 aarch64 cross-compiler for Raspberry Pi+
 +# Slackware ARM gcc-13.2.0 AArch64 cross-compiler for Raspberry Pi
 # #
 # SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc [v1.6] - 2023-10-14 # SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc [v1.6] - 2023-10-14
Line 58: Line 59:
 # #
 ### Installation & Usage ### ### Installation & Usage ###
 +#
 # You should create a 'build-dir' folder and copy this script to it  # You should create a 'build-dir' folder and copy this script to it 
 # (e.g. /tmp/build-dir) and run it from there as a 'root' user.  # (e.g. /tmp/build-dir) and run it from there as a 'root' user. 
Line 86: Line 88:
 # #
 # ~# gcc --version # ~# gcc --version
 +#
 +# Copy the Linux kernel-headers package to /tmp/usr and delete asm directory.
 +# Then symlink it to asm-armv8 directory:
 +#
 +# root@jook:/tmp/usr/include# rm -rf asm
 +# root@jook:/tmp/usr/include# ln -sf asm-armv8 asm
 # #
 # More recent gcc packages-versions may exist. You may wish to install them.  # More recent gcc packages-versions may exist. You may wish to install them. 
Line 113: Line 121:
 # #
 ### Disclaimer ### ### Disclaimer ###
 +#
 # This script was created on Slackware ARM and intended for development  # This script was created on Slackware ARM and intended for development 
 # and testing on Slackware AArch64. This script may work on other Linux  # and testing on Slackware AArch64. This script may work on other Linux 
Line 120: Line 129:
 # Slackware AArch64.  # Slackware AArch64. 
 # #
-# Copyright 2016-2022 Exagasarpi.penthux.net +  Copyright (c) 2016-2024 Exaga sarpi.penthux.net
-# All rights reserved.+
 # #
 #   Permission to use, copy, modify, and distribute this software for #   Permission to use, copy, modify, and distribute this software for
 #   any purpose with or without fee is hereby granted, provided that #   any purpose with or without fee is hereby granted, provided that
-#   the above copyright notice and this permission notice appear in all +#   the above copyright notice and this disclaimer notice appear in  
-#   copies.+#   all copies. All rights reserved.
 # #
 #   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED #   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
Line 168: Line 176:
  
 # RPi GitHub Linux source - working branch [e.g. rpi-5.15.y | rpi-5.19.y | rpi-6.1.y  # RPi GitHub Linux source - working branch [e.g. rpi-5.15.y | rpi-5.19.y | rpi-6.1.y 
-DEV_BRANCH=rpi-6.1.y+DEV_BRANCH=rpi-6.6.y
  
  
Line 184: Line 192:
 # Build variables # Build variables
 PRGNAM=SARPi64.SlackBuild-aarch64-cc PRGNAM=SARPi64.SlackBuild-aarch64-cc
-ARCH_TARGET=aarch64-linux  +ARCH_TARGET=aarch64-linux
 LINUX_ARCH=arm64 LINUX_ARCH=arm64
 QUADLET=aarch64-unknown-linux-gnu # aarch64-arm-none-eabi QUADLET=aarch64-unknown-linux-gnu # aarch64-arm-none-eabi
Line 190: Line 198:
 RPI_GITURL_LINUX=https://github.com/raspberrypi RPI_GITURL_LINUX=https://github.com/raspberrypi
 BUILD_LANGUAGES="--enable-languages=c,c++" # --enable-languages=all,ada,c,c++,fortran,go,jit,lto,objc,obj-c++ BUILD_LANGUAGES="--enable-languages=c,c++" # --enable-languages=all,ada,c,c++,fortran,go,jit,lto,objc,obj-c++
-ALT_CONFIG_OPTIONS="--disable-multilib" --disable-threads --disable-shared --disable-multiarch+ALT_CONFIG_OPTIONS="--disable-multilib" 
 +BLD_CONFIG_OPTIONS="--disable-multilib --disable-threads --disable-shared --disable-multiarch -mcpu=cortex-a53+crc -mtune=cortex-a53 --disable-fixincludes --with-system-zlib"  
 TEST_CONFIG_OPTIONS="--with-arch=armv8-a --with-tune=cortex-a72 --with-fpu=vfpv3-d16 --with-float=hard" TEST_CONFIG_OPTIONS="--with-arch=armv8-a --with-tune=cortex-a72 --with-fpu=vfpv3-d16 --with-float=hard"
-RPI4_CONFIG_OPTIONS="--prefix=$INSTALL_PATH --target=arm-linux-gnueabihf --enable-languages=c,c++ --with-arch=armv8-a --with-fpu=vfp --with-float=hard --disable-multilib" #  +RPI_CONFIG_OPTIONS="--prefix=$INSTALL_PATH --target=arm-linux-gnueabihf --enable-languages=c,c++ --with-arch=armv8-a --with-fpu=vfp --with-float=hard --disable-multilib" #  
-PARALLEL_JOBS=-j4 # https://www.gnu.org/software/make/manual/html_node/Parallel.html+# https://www.gnu.org/software/make/manual/html_node/Parallel.html 
 +PARALLEL_JOBS=-j4 
 CWD=$(pwd) CWD=$(pwd)
  
 # Define CONFIG_OPTIONS for build # Define CONFIG_OPTIONS for build
 CONFIG_OPTIONS=$ALT_CONFIG_OPTIONS CONFIG_OPTIONS=$ALT_CONFIG_OPTIONS
 +
 +# Set bulletin
 +set -e
 +
 +# INSTALL_PATH needs to be at the front of $PATH
 +# Command: export PATH=/tmp/.gcc-cross/bin:$PATH
 +echo "Checking $ARCH_TARGET $INSTALL_PATH/bin \$PATH ..."
 +if [[ ! "$PATH" =~ $INSTALL_PATH ]]; then
 +    export PATH=/"${INSTALL_PATH}"/bin:$PATH 
 +else
 +    echo "Found $INSTALL_PATH\/bin in \$PATH : OK! ... "
 +fi
  
 # Uncomment to log EVERYTHING during build process [** WARNING! HUGE log filesize! **] # Uncomment to log EVERYTHING during build process [** WARNING! HUGE log filesize! **]
Line 217: Line 239:
 sarpiSP64 sarpiSP64
 echo "Starting $PRGNAM build ..." echo "Starting $PRGNAM build ..."
- 
-# INSTALL_PATH needs to be at the front of $PATH 
-# Command: export PATH=/tmp/.gcc-cross/bin:$PATH 
-echo "Checking $ARCH_TARGET $INSTALL_PATH/bin \$PATH ..." 
-if [[ ! "$PATH" =~ $INSTALL_PATH ]]; then 
-    export PATH=/"${INSTALL_PATH}"/bin:$PATH  
-# echo -e $INSTALL_PATH/bin:$(cat $PATH) > $PATH || exit 1 
-else 
-    echo "Found $INSTALL_PATH\/bin in \$PATH : OK! ... " 
-fi 
  
 # Prerequisite packages # Prerequisite packages
Line 238: Line 250:
   echo "ERROR: bison not found!"   echo "ERROR: bison not found!"
   echo "Install bison before you run this script!"   echo "Install bison before you run this script!"
-  exit 1+  exit 1;
 elif [ ! -e "$FLEX_REQ" ]; then elif [ ! -e "$FLEX_REQ" ]; then
   echo "ERROR: flex not found!"   echo "ERROR: flex not found!"
   echo "Install flex before you run this script!"   echo "Install flex before you run this script!"
-  exit 1+  exit 1;
 elif [ ! -e "$GAWK_REQ" ]; then elif [ ! -e "$GAWK_REQ" ]; then
   echo "ERROR: gawk not found!"   echo "ERROR: gawk not found!"
   echo "Install gawk before you run this script!"   echo "Install gawk before you run this script!"
-  exit 1+  exit 1;
 elif [ ! -e "$GIT_REQ" ]; then elif [ ! -e "$GIT_REQ" ]; then
   echo "ERROR: git not found!"   echo "ERROR: git not found!"
   echo "Install git before you run this script!"   echo "Install git before you run this script!"
-  exit 1+  exit 1;
 else else
   echo "Prerequisite packages are installed ..."    echo "Prerequisite packages are installed ..."
 fi fi
 +
 +# Delete build-binutils directory [if it exists]
 +rm -rf build-binutils
 +mkdir build-binutils
  
 # Download RPi kernel source ** this may take a while ** # Download RPi kernel source ** this may take a while **
Line 260: Line 276:
 if [ ! -e $LINUX_FLAVOUR/Makefile ]; then if [ ! -e $LINUX_FLAVOUR/Makefile ]; then
   echo "Downloading kernel $DEV_BRANCH source ..."   echo "Downloading kernel $DEV_BRANCH source ..."
-  git clone --depth=1 $RPI_GITURL_LINUX/linux.git --branch $DEV_BRANCH $LINUX_FLAVOUR+  git clone --branch $DEV_BRANCH --depth=1 $RPI_GITURL_LINUX/linux.git $LINUX_FLAVOUR
 fi fi
 cd $LINUX_FLAVOUR cd $LINUX_FLAVOUR
Line 302: Line 318:
 fi fi
  
-# Create symbolic links so gcc builds these dependencies automatically +# Create symbolic links so gcc builds these dependenciesThis can be done  
-This can be done automagically by using this command in gcc source dir: +automagically by using the following command in gcc source dir: 
 # ./contrib/download_prerequisites # ./contrib/download_prerequisites
 # #
Line 323: Line 339:
 # Build binutils # Build binutils
 echo "Building binutils ..." echo "Building binutils ..."
-rm -rf build-binutils 
-mkdir build-binutils 
 cd build-binutils cd build-binutils
-../$BINUTILS_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $CONFIG_OPTIONS --with-sysroot --disable-nls --disable-werror+../$BINUTILS_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $CONFIG_OPTIONS
 make $PARALLEL_JOBS make $PARALLEL_JOBS
 echo "Installing binutils ..." echo "Installing binutils ..."
Line 341: Line 355:
 mkdir -p build-gcc mkdir -p build-gcc
 cd build-gcc cd build-gcc
-../$GCC_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $BUILD_LANGUAGES $CONFIG_OPTIONS --disable-nls --disable-bootstrap+../$GCC_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $BUILD_LANGUAGES $CONFIG_OPTIONS --disable-libsanitizer
 make $PARALLEL_JOBS all-gcc make $PARALLEL_JOBS all-gcc
 echo "Installing gcc $ARCH_TARGET cross-compiler to $INSTALL_PATH ..." echo "Installing gcc $ARCH_TARGET cross-compiler to $INSTALL_PATH ..."
Line 366: Line 380:
 EOF EOF
  
-# Patch gcc-13.2.x/libsanitizerasan/asan_linux.cpp [or the build will fail]+# Patch gcc-13.2.x/libsanitizerasan/asan_linux.cpp [for posterity]
 ASANLINUXCC=$CWD/$GCC_VERSION/libsanitizer/asan/asan_linux.cpp ASANLINUXCC=$CWD/$GCC_VERSION/libsanitizer/asan/asan_linux.cpp
 if [ ! -f "$ASANLINUXCC".orig ]; then if [ ! -f "$ASANLINUXCC".orig ]; then
   echo "Patching $ASANLINUXCC ..."   echo "Patching $ASANLINUXCC ..."
-  patch -b "$ASANLINUXCC" asan_linux-cpp.patch || exit 1+  patch -b "$ASANLINUXCC" asan_linux-cpp.patch || exit 1;
   sarpiSP64   sarpiSP64
   echo "$ASANLINUXCC has been PATCHED! ..."   echo "$ASANLINUXCC has been PATCHED! ..."
Line 381: Line 395:
 mkdir -p build-glibc mkdir -p build-glibc
 cd build-glibc cd build-glibc
-../$GLIBC_VERSION/configure --prefix=$INSTALL_PATH/$ARCH_TARGET --build="$MACHTYPE" --host=$ARCH_TARGET --target=$ARCH_TARGET --with-headers=$INSTALL_PATH/$ARCH_TARGET/include $CONFIG_OPTIONS libc_cv_forced_unwind=yes+../$GLIBC_VERSION/configure --prefix=$INSTALL_PATH/$ARCH_TARGET --build="$MACHTYPE" --host=$ARCH_TARGET --target=$ARCH_TARGET $CONFIG_OPTIONS libc_cv_forced_unwind=yes
 make $PARALLEL_JOBS install-bootstrap-headers=yes install-headers make $PARALLEL_JOBS install-bootstrap-headers=yes install-headers
 make $PARALLEL_JOBS csu/subdir_lib make $PARALLEL_JOBS csu/subdir_lib
Line 420: Line 434:
   sarpiSP64   sarpiSP64
   echo "$(date +"%F %T") : $PRGNAM FAILED! ..."   echo "$(date +"%F %T") : $PRGNAM FAILED! ..."
-  exit 1+  exit 1;
 else  else 
   # Done!   # Done!
Line 430: Line 444:
 fi fi
  
-Done+
 exit 0; exit 0;
  
 howtos:hardware:arm:gcc-13.x_aarch64_cross-compiler ()