/|\

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 revision Previous revision
howtos:hardware:arm:gcc-9.x_aarch64_cross-compiler [2019/08/03 12:46 (UTC)]
exaga [Building the gcc aarch64 cross-compiler] missing CFLAG
howtos:hardware:arm:gcc-9.x_aarch64_cross-compiler [2020/02/25 19:07 (UTC)] (current)
exaga updated to gcc-9.2.0
Line 1: Line 1:
-====== Slackware ARM gcc-9.1.x armv8 arm64 aarch64 cross-compiler for the Raspberry Pi 4 ======+====== Slackware ARM gcc-9.2.x armv8 arm64 aarch64 cross-compiler for the Raspberry Pi 4 ======
  
 === Preface === === Preface ===
  
-With the recent congruous updates to [[http://arm.slackware.com|Slackware ARM]] [~24 June 2019 - "A MILLION THANKS to MoZes!"] and the surprise arrival of the Raspberry Pi 4, this just had to be done. Creating a 64-bit gcc-9.1.0 arm64 aarch64 cross-compiler with the intention of building aarch64-linux binaries from source code and turning them into Slackware packages. +With the recent congruous updates to [[http://arm.slackware.com|Slackware ARM]] [~24 June 2019 - "A MILLION THANKS to MoZes!"] and the surprise arrival of the Raspberry Pi 4, this just had to be done. Creating a 64-bit gcc-9.2.0 arm64 aarch64 cross-compiler with the intention of building aarch64-linux binaries from source code and turning them into Slackware packages. 
  
-Previous [[howtos:hardware:arm:gcc_aarch64_cross-compiler|work in this area]] had already been done since 2016/2017. However, this time we'll be compiling with gcc-9.1.0 and not gcc-5.4.0 and we'll be using a Raspberry Pi 4 Model B and not a Mk3 version. The old build scripts weren't totally useless and some of the code was reused for this project, to save time.+Previous [[howtos:hardware:arm:gcc_aarch64_cross-compiler|work in this area]] had already been done since 2016/2017. However, this time we'll be compiling with gcc-9.2.0 and not gcc-5.4.0 and we'll be using a Raspberry Pi 4 Model B and not a Mk3 version. The old build scripts weren't totally useless and some of the code was reused for this project, to save time.
  
 === Notes === === Notes ===
  
-Slackware ARM current was used on a Raspberry Pi 4 to build and install the gcc-9.1.0 aarch64-linux cross-compiler, and build the armv8 Linux kernel, modules, and device tree blob(s). This was to achieve the highest degree of compatibility possible.+Slackware ARM current was used on a Raspberry Pi 4 to build and install the gcc-9.2.0 aarch64-linux cross-compiler, and build the armv8 Linux kernel, modules, and device tree blob(s). This was to achieve the highest degree of compatibility possible.
  
 In this guide we are using '/tmp/build-dir' for our temporary 'BUILD' directory and '/tmp/.gcc-cross' as our permanent 'INSTALL' directory. '/tmp/.gcc-cross' is the location where the gcc cross-compiler will be located after it's been compiled. You can, of course, use your own locations for both of these directories. In this guide we are using '/tmp/build-dir' for our temporary 'BUILD' directory and '/tmp/.gcc-cross' as our permanent 'INSTALL' directory. '/tmp/.gcc-cross' is the location where the gcc cross-compiler will be located after it's been compiled. You can, of course, use your own locations for both of these directories.
  
-**NB:** The gcc-9.1.0 'libsanitizer asan' might need patching before building glibc-2.29 if the compile crashes unexpectedly. If this is a problem for you then patching the offending gcc-9.1.0/libsanitizer/asan/asan_linux.cc source file will get around this issue. The issue itself is that no PATH_MAX has been defined in the source and there needs to be a value set in order for it to compile successfully. Instructions on how to successfully patch this file are included herein, should they be needed.+**NB:** The gcc-9.2.0 'libsanitizer asan' might need patching before building glibc-2.29 if the compile crashes unexpectedly. If this is a problem for you then patching the offending gcc-9.2.0/libsanitizer/asan/asan_linux.cc source file will get around this issue. The issue itself is that no PATH_MAX has been defined in the source and there needs to be a value set in order for it to compile successfully. Instructions on how to successfully patch this file are included herein, should they be needed.
  
 === Requirements === === Requirements ===
Line 24: Line 24:
 === What's involved === === What's involved ===
 This tutorial will enable you to; This tutorial will enable you to;
-  * download the required package source(s) in order to build a gcc-9.1.0 cross-compiler on Slackware ARM. \\ +  * download the required package source(s) in order to build a gcc-9.2.0 cross-compiler on Slackware ARM. \\ 
   * download the Raspberry Pi Linux kernel [[https://www.github.com/raspberrypi/linux|GitHub]] tree rpi-5.2.y development branch. \\    * download the Raspberry Pi Linux kernel [[https://www.github.com/raspberrypi/linux|GitHub]] tree rpi-5.2.y development branch. \\ 
-  * configure, and install, a gcc-9.1.0 aarch64-linux (armv8) cross-compiler on your Raspberry Pi 4. \\ +  * configure, and install, a gcc-9.2.0 aarch64-linux (armv8) cross-compiler on your Raspberry Pi 4. \\ 
   * build the aarch64 (armv8) Linux kernel, modules, and device tree blob(s), and install them on your [spare] Slackware ARM current microSD card. \\    * build the aarch64 (armv8) Linux kernel, modules, and device tree blob(s), and install them on your [spare] Slackware ARM current microSD card. \\ 
   * successfully boot Slackware ARM current on your Raspberry Pi 4 running an aarch64 (armv8) kernel.   * successfully boot Slackware ARM current on your Raspberry Pi 4 running an aarch64 (armv8) kernel.
Line 71: Line 71:
 === Downloading required package source === === Downloading required package source ===
  
-Before downloading the package source needed to build the gcc cross-compiler, be aware that more recent package versions may exist than the ones shown here. You may wish to install newer versions. It's always a good idea to check. To keep things simple, you might consider downloading a version of gcc which matches the one you currently have installed. I've read lots of articles about this and most advise to install the //latest and greatest// version of gcc available. However, if you're running Slackware ARM current you'll have gcc-9.1.0 installed and this is adequate for what you need.+Before downloading the package source needed to build the gcc cross-compiler, be aware that more recent package versions may exist than the ones shown here. You may wish to install newer versions. It's always a good idea to check. To keep things simple, you might consider downloading a version of gcc which matches the one you currently have installed. I've read lots of articles about this and most advise to install the //latest and greatest// version of gcc available. However, if you're running Slackware ARM current you'll have gcc-9.2.0 installed and this is adequate for what you need.
  
 So, first move back into the 'BUILD' directory and then download the packages below. So, first move back into the 'BUILD' directory and then download the packages below.
Line 79: Line 79:
 wget -nc https://ftp.gnu.org/gnu/binutils/binutils-2.32   wget -nc https://ftp.gnu.org/gnu/binutils/binutils-2.32  
 wget -nc ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.1    wget -nc ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.1   
-wget -nc https://ftp.gnu.org/gnu/gcc/gcc-9.1.0  +wget -nc https://ftp.gnu.org/gnu/gcc/gcc-9.2.0  
 wget -nc https://ftp.gnu.org/gnu/glibc/glibc-2.29   wget -nc https://ftp.gnu.org/gnu/glibc/glibc-2.29  
 wget -nc https://ftp.gnu.org/gnu/gmp/gmp-6.1.2   wget -nc https://ftp.gnu.org/gnu/gmp/gmp-6.1.2  
Line 99: Line 99:
 === Creating gcc dependency symlinks === === Creating gcc dependency symlinks ===
  
-Now you are going to create some symbolic links in the gcc-9.1.0 directory. These will point to some of the source directories you have just unpacked, which are dependencies of gcc, and when these symbolic links are present gcc will build them automatically.+Now you are going to create some symbolic links in the gcc-9.2.0 directory. These will point to some of the source directories you have just unpacked, which are dependencies of gcc, and when these symbolic links are present gcc will build them automatically.
  
 <code> <code>
-cd gcc-9.1.0+cd gcc-9.2.0
 ln -sf ../cloog-0.18.1 cloog ln -sf ../cloog-0.18.1 cloog
 ln -sf ../gmp-6.1.2 gmp ln -sf ../gmp-6.1.2 gmp
Line 113: Line 113:
  
 <code> <code>
-cd gcc-9.1.0+cd gcc-9.2.0
 ./contrib/download_prerequisites ./contrib/download_prerequisites
 </code> </code>
Line 119: Line 119:
 Personally, I always prefer the manual method because then I know what's being downloaded/installed and what to expect. It's up to you which method you use. Personally, I always prefer the manual method because then I know what's being downloaded/installed and what to expect. It's up to you which method you use.
  
-=== Creating gcc-9.1.0 cross-compiler install directory  ===+=== Creating gcc-9.2.0 cross-compiler install directory  ===
  
 The next thing to do is create an 'INSTALL' directory. This is the directory where the gcc cross-compiler will be installed. As before, I like to work from the '/tmp' directory so the install directory is where I will locate it. The next thing to do is create an 'INSTALL' directory. This is the directory where the gcc cross-compiler will be installed. As before, I like to work from the '/tmp' directory so the install directory is where I will locate it.
Line 131: Line 131:
 === Exporting install directory PATH === === Exporting install directory PATH ===
  
-You need to export the installation directory's '/bin' folder to your user's $PATH. The PATH of your gcc-9.1.0 cross-compiler bin needs to be the __FIRST__ item in the $PATH in order to be successful.+You need to export the installation directory's '/bin' folder to your user's $PATH. The PATH of your gcc-9.2.0 cross-compiler bin needs to be the __FIRST__ item in the $PATH in order to be successful.
  
 <code> <code>
Line 185: Line 185:
 mkdir build-gcc mkdir build-gcc
 cd build-gcc cd build-gcc
-../gcc-9.1.0/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --enable-languages=c,c++ --disable-multilib+../gcc-9.2.0/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --enable-languages=c,c++ --disable-multilib
 make -j4 all-gcc make -j4 all-gcc
 make -j4 install-gcc make -j4 install-gcc
Line 192: Line 192:
 === Patching gcc before compiling glibc === === Patching gcc before compiling glibc ===
  
-If you find that compiling glibc is problematic, or crashes every time, and it concerns 'libsantizer asan' you will need to patch gcc-9.1.0 before it will compile successfully.+If you find that compiling glibc is problematic, or crashes every time, and it concerns 'libsantizer asan' you will need to patch gcc-9.2.0 before it will compile successfully.
  
 First, move into your 'BUILD' directory and create the patch file. First, move into your 'BUILD' directory and create the patch file.
Line 223: Line 223:
  
 <code> <code>
-patch -b gcc-9.1.0/libsanitizer/asan/asan_linux.cc asan_linux-cc.patch+patch -b gcc-9.2.0/libsanitizer/asan/asan_linux.cc asan_linux-cc.patch
 </code> </code>
  
 This will patch the file and create a backup [option -b] in case things don't go as planned. Now you should find that glibc compiles without any problem(s). This will patch the file and create a backup [option -b] in case things don't go as planned. Now you should find that glibc compiles without any problem(s).
  
-NB: The location of the backed up file is: gcc-9.1.0/libsanitizer/asan/asan_linux.cc.orig+NB: The location of the backed up file is: gcc-9.2.0/libsanitizer/asan/asan_linux.cc.orig
  
  
Line 294: Line 294:
 Using built-in specs. Using built-in specs.
 COLLECT_GCC=aarch64-linux-gcc COLLECT_GCC=aarch64-linux-gcc
-COLLECT_LTO_WRAPPER=/tmp/.gcc-cross/libexec/gcc/aarch64-linux/9.1.0/lto-wrapper+COLLECT_LTO_WRAPPER=/tmp/.gcc-cross/libexec/gcc/aarch64-linux/9.2.0/lto-wrapper
 Target: aarch64-linux Target: aarch64-linux
-Configured with: ../gcc-9.1.0/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --enable-languages=c,c++ --disable-multilib : (reconfigured) ../gcc-9.1.0/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --enable-languages=c,c++ --disable-multilib+Configured with: ../gcc-9.2.0/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --enable-languages=c,c++ --disable-multilib : (reconfigured) ../gcc-9.2.0/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --enable-languages=c,c++ --disable-multilib
 Thread model: posix Thread model: posix
-gcc version 9.1.0 (GCC)+gcc version 9.2.0 (GCC)
  
 </code> </code>
Line 529: Line 529:
 Linux 5.2.1-v8-aarch64. Linux 5.2.1-v8-aarch64.
 root@drie:~# cat /proc/version root@drie:~# cat /proc/version
-Linux version 5.2.1-v8-aarch64 (exaga@torq) (gcc version 9.1.0 (GCC)) #1 SMP Thu Jul 18 18:19:49 BST 2019+Linux version 5.2.1-v8-aarch64 (exaga@torq) (gcc version 9.2.0 (GCC)) #1 SMP Thu Jul 18 18:19:49 BST 2019
 exaga@torq:~# uname -a exaga@torq:~# uname -a
 Linux torq 5.2.1-v8-aarch64 #2 SMP Thu Jul 18 18:19:49 BST 2019 aarch64 GNU/Linux Linux torq 5.2.1-v8-aarch64 #2 SMP Thu Jul 18 18:19:49 BST 2019 aarch64 GNU/Linux
Line 547: Line 547:
 There's a new SARPi64 Project website which focusses on all things Slackware AArch64 ARM64 ARMv8 related. From here we hope to develop and distribute experimental binary  packages and installer disk images for Slackware ARM, amongst other content. The SARPi64 Project website URL is: [[http://sarpi64.fatdog.eu/]] There's a new SARPi64 Project website which focusses on all things Slackware AArch64 ARM64 ARMv8 related. From here we hope to develop and distribute experimental binary  packages and installer disk images for Slackware ARM, amongst other content. The SARPi64 Project website URL is: [[http://sarpi64.fatdog.eu/]]
  
-An automated gcc-9.1.0 aarch64 cross-compiler build [bash] script is available here: [[http://sarpi64.fatdog.eu/files/extra/SARPi64.SlackBuild-aarch64-cc.txt]]+An automated gcc-9.2.0 aarch64 cross-compiler build [bash] script is available here: [[http://sarpi64.fatdog.eu/files/extra/SARPi64.SlackBuild-aarch64-cc.txt]]
  
 Thanks for being interested. <3 Thanks for being interested. <3

In Other Languages
QR Code
QR Code howtos:hardware:arm:gcc-9.x_aarch64_cross-compiler (generated for current page)