-
-
Notifications
You must be signed in to change notification settings - Fork 107
Cross Compiler: Installation Instructions
These ARM toolchains can be used on any Linux Distributions (32-bit/64-bit) for cross-compiling programs for Raspberry Pi 32-Bit OS flavors.
Warning
The Stretch (Debian Version 9) 32-bit/64-bit toolchains are no longer supported!
-
Buster: Generates programs for Raspberry Pi Buster 32-bit OS (a.k.a Debian Version 10) and any equivalent OS only.
- GCC core libraries version:
- Glibc version: 2.28
- Binutils version: 2.31.1
- GDB version: 15.1
- GCC core libraries version:
-
Bullseye: Generates programs for Raspberry Pi Bullseye 32-bit OS (a.k.a Debian Version 11) and any equivalent OS only.
- GCC core libraries version:
- Glibc version: 2.31
- Binutils version: 2.35.2
- GDB version: 15.1
- GCC core libraries version:
-
Bookworm: Generates programs for Raspberry Pi Bookworm 32-bit OS (a.k.a Debian Version 12) and any equivalent OS only.
- GCC core libraries version:
- Glibc version: 2.36
- Binutils version: 2.40
- GDB version: 15.1
- GCC core libraries version:
Important
- These instructions are exclusively for GCC version
14.2.0
but will work with any cross-compiler version available with this project. - These instructions are Linux-machines specific only.
Note
Our Cross-Compiler toolchains also works out-of-the-box on any Linux distro via WSL2 on Windows 10 Machines. 💯
-
Update your environment:
sudo apt update && sudo apt dist-upgrade
-
Install Important Packages:
sudo apt-get install build-essential gawk gcc g++ gfortran git texinfo bison libncurses-dev
Our pre-compiled TAR-PIGZ compressed and OS-targeted GCC Toolchain binaries can easily be downloaded from the project's SourceForge Repository or by clicking the links provided in the following table:
Note
- Host OS: on which the toolchain is executed/used.
- Target OS: for which the toolchain generates code.
Warning
The Stretch (Debian Version 9) 32-bit/64-bit toolchains are no longer supported!
Toolchains | Host OS | Target OS | Current Status | Precompiled GCC versions available |
---|---|---|---|---|
Raspberry Pi GCC Cross-Compiler Toolchains (Buster) | any x64/x86 Linux machine | Buster 32-bit OS (Debian Version 10) only | Stable/Production | 8.3.0, 10.2.0, 12.2.0, 13.3.0, 14.2.0 |
Raspberry Pi GCC Cross-Compiler Toolchains (Bullseye) | any x64/x86 Linux machine | Bullseye 32-bit OS (Debian Version 11) only | Stable/Production | 10.2.0, 12.2.0, 13.3.0, 14.2.0 |
Raspberry Pi GCC Cross-Compiler Toolchains (Bookworm) | any x64/x86 Linux machine | Bookworm 32-bit OS (Debian Version 12) only | Stable/Production | 12.2.0, 13.3.0, 14.2.0 |
These Raspberry toolchains have the same standardized headers with no hardcoded paths, thereby can be directly used for immediate application OR can be installed permanently for on a daily basis usage:
-
Extraction: Extract using
tar
terminal command as follows:tar xf <filename e.g cross-gcc-14.2.0-pi_2-3.tar.gz>
-
Linking:
PATH=/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/bin:$PATH LD_LIBRARY_PATH=/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/lib:$LD_LIBRARY_PATH
-
Extraction: Extract using
tar
terminal command as follows:tar xf <filename e.g cross-gcc-14.2.0-pi_2-3.tar.gz>
-
Configuring: Move extracted folder to any location (for e.g.
/opt
) by using following command:sudo mv <extracted folder-name e.g cross-pi-gcc-14.2.0-1> /opt
-
Linking: Properly link Path/Environment Variables permanently with either of the following given methods:
-
Appending variables to your
.profile
: (Recommended)echo 'export PATH=/opt/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/bin:$PATH' >> .profile echo 'export LD_LIBRARY_PATH=/opt/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/lib:$LD_LIBRARY_PATH' >> .profile source .profile
-
Appending variables to your
.bashrc
:⚠️ Some Linux users reported some trouble with configuring path variables at.profile
that doesn't seem to work for them. If you encounter a similar problem, try setting/configure by adding paths to your.bashrc
file instead of as follows:echo 'export PATH=/opt/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/bin:$PATH' >> .bashrc echo 'export LD_LIBRARY_PATH=/opt/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/lib:$LD_LIBRARY_PATH' >> .bashrc source .bashrc
-
-
Cross Compiler CMake Usage Guide for 32-bit Raspberry Pi OSes
-
Step-by-Step Instructions for Cross-Compiling Latest QT Framework for Raspberry Pi.
-
To enable Link-time-optimization (LTO):
export AR="arm-linux-gnueabihf-gcc-ar" export CC="arm-linux-gnueabihf-gcc" export CXX="arm-linux-gnueabihf-g++" export CPP="arm-linux-gnueabihf-cpp" export FC="arm-linux-gnueabihf-gfortran" export RANLIB="arm-linux-gnueabihf-gcc-ranlib" export LD="$CXX" GCCPATH="/<extracted folder-name e.g cross-pi-gcc-14.2.0-1>/libexec/gcc/arm-linux-gnueabihf/14.2.0" export ARFLAGS="--plugin $GCCPATH/liblto_plugin.so" export RANLIBFLAGS="--plugin $GCCPATH/liblto_plugin.so"
Note
LTO also needs g++ to be the linker, and it can be enabled at compile-time by setting -flto=$(nproc)
and -fno-fat-lto-objects
flags in CFLAGS, CXXFLAGS, and LDFLAGS respectively.
If these binaries helped you big time, please consider supporting it. Thank you.
Also, don't forget to share your views & drop a ⭐
- Native-Compiler ARM Toolchains Guide
- Cross-Compiler ARM Toolchains Guide
- Native-Compiler 64-Bit GCC ARM64 Toolchains Guide
- Cross-Compiler 64-Bit GCC ARM64 Toolchains Guide