Slackware ARM64 AArch64 on a Raspberry Pi


SARPi64 How-To ... Build A GCC-5.5.x AArch64 Cross-Compiler

To build your own gcc-5.4.x ARM64 AArch64 cross-compiler you can go about it in two ways.

1. Build manually.
2. Use an automated bash script to build for you.

Both methods can be realised from the information contained within this page. It's up to you and whichever way works best to suit your needs. The manual method is advised just for the learning curve. ;-)

IMPORTANT! The procedures on this page should all be carried out as a normal user on your system and NOT 'root' user!

When things go inexplicably and unexpectedly awry, which they OFTEN do during experimental binary compilations, you do not want to run any build process as 'root' user, because it can have an adverse effect on the integrity of your operating system. Never use 'root' user unless you specifically need to.

The Manual Method

The manual method of building your own gcc-5.4.x ARM64 AArch64 cross-compiler is by far the better route to success. The process involves downloading the source code and compiling it piece by piece, in a set order. Much like baking a cake. The end result is a tonne of education and experience of how to construct toolchains, the packages and commands [structure] involved, in an end-to-end process. However, the SARPi64 Project is not going to re-invent the wheel in terms of offering a walk-through tutorial on how to achieve this, because it's already been documented and published, by Exaga, on the Slackware Documentation Project website.

See the following SlackDocs webpage, a step-by-step guide on how to build a gcc-5.4.0 aarch64-linux cross-compiler from scratch with Slackware ARM on the Raspberry Pi 3: https://docs.slackware.com/howtos:hardware:arm:gcc_aarch64_cross-compiler

Should you need it, the AArch64 Linux kernel 4.14.0 .config is available to download.

The Automated Method

The automated method is as easy as copying a file [code], renaming it, changing the file permissions, and executing [running] the script. Although this is the easiest and most effortless method, you don't learn anything from doing it. So if this is your preferred method you'll need to; download the following text file to a 'BUILD' directory on your system, rename the file, and set owner permissions to make it executable. For example, if you are working in the /tmp directory:

user@slackbox:~$ mkdir -p /tmp/_build_dir
user@slackbox:/tmp$ cd /tmp/_build_dir
user@slackbox:/tmp/_build_dir$ wget http://sarpi64.fatdog.eu/files/extra/rpi3-build-gcc-arm64-cross-compiler.txt
user@slackbox:/tmp/_build_dir$ cp rpi3-build-gcc-arm64-cross-compiler.txt rpi3-build-gcc-arm64-cross-compiler.sh
user@slackbox:/tmp/_build_dir$ chmod a+x rpi3-build-gcc-arm64-cross-compiler.sh
user@slackbox:/tmp/_build_dir$

Alternatively, once inside your 'BUILD' directory, you can download the script file, rename it, and set the owner persmissions to executable in a 'one-liner' if you prefer.

user@slackbox:/tmp/_build_dir$ wget http://sarpi64.fatdog.eu/files/extra/rpi3-build-gcc-arm64-cross-compiler.txt \
-O rpi3-build-gcc-arm64-cross-compiler.sh && chmod a+x rpi3-build-gcc-arm64-cross-compiler.sh

For those who are not using a terminal, here's a clickable link to the rpi3-build-gcc-arm64-cross-compiler.txt file.

When you have the script file in place in your 'BUILD' directory, run it by using the following:

user@slackbox:/tmp/_build_dir$ ./rpi3-build-gcc-arm64-cross-compiler.sh

The build process will take some hours to compile and complete. If you have anything else to do in the meantime, now is a good opportunity.

Things To Note

The gcc compiler you are downloading MUST match the gcc version you have currently installed on your system. You can check this easily by using the following command: 'gcc --version'

user@slackbox:~$ gcc --version
gcc (GCC) 5.5.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
user@slackbox:/tmp/_build_dir$

Strange things might, and probably will, happen during compilation if you do not adhere to the above precondition.

The 'PATH' to your 'aarch64-linux-gcc/bin' directory needs to be in the $PATH before the build script will run successfully. If you have not modified the default install directory [specified by the INSTALL_PATH variable in the build script] then using the following command will achieve this:

user@slackbox:~$ export PATH=/tmp/.gcc-cross/bin:$PATH

NB: '/tmp/.gcc-cross' being the directory in which our gcc cross-compiler was installed. If yours has been installed into another directory then adjust the /path/to/your/gcc-cross/bin directory parameter accordingly. An ERROR notice should appear informing you that the cross-compiler PATH is not in the $PATH, and the script will 'exit 1' if you have neglected to do this beforehand.

Support for Slackware ARM

If you're in need of help, or have something to contribute, one of the best places to get (and offer) support for Slackware ARM is on the Linux Questions Forum. Another valuable resource is the Slackware Documentation Project.

Updated: 04 Aug 2019 16:08:40