Skip to content

Latest commit

 

History

History

build-scripts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Banner

 

Note

This project now provides user-friendly open-sourced bash build-scripts to automatically generate compressed cross and native GCC ARM/ARM64 toolchain binaries for Raspberry Pi 32-bit and 64-bit operating. If you need additional language support or want to compile other suitable GCC version toolchains for your Raspberry Pi, you can manually compile any GCC toolchains by running the appropriate build scripts through your system terminal.

Warning

The Stretch (Debian Version 9) 32-bit/64-bit toolchains are no longer supported!

RTBuilder_32b: Raspberry Pi Toolchains 32-bit Builder Build Script

  • This script auto-generates Compressed Cross & Native GCC ARM Toolchain binaries targeting Raspberry Pi 32-bit Buster(Debian 10), Bullseye(Debian 11), and Bookworm(Debian 12) OSes.

RTBuilder_64b: Raspberry Pi Toolchains 64-bit Builder Build Script

  • This script auto-generates Compressed Cross & Native GCC ARM Toolchain binaries targeting Raspberry Pi 64-bit Buster(Debian 10), Bullseye(Debian 11), and Bookworm(Debian 12) OSes.

 

Features

  • Generates toolchains for Raspberry Pi OS Buster (Debian 10), Bullseye (Debian 11), and Bookworm (Debian 12)
  • Supports both 32-bit and 64-bit architectures
  • Customizable GCC versions and target Raspberry Pi models
  • Option for verbose output for debugging

 

Usage

You can run these bash scripts to manually compile any GCC toolchains version through your system terminal:

0. Prerequisites ⚠️

  • Linux-OS based machine
  • Active internet connection

1. Update environment & Install prerequisites 🔧

# update your system
sudo apt update && sudo apt dist-upgrade

# install prerequisites
sudo apt-get -y install gcc g++ gperf flex texinfo gawk gfortran texinfo bison \
    build-essential openssl unzip wget git pigz libgmp-dev \
    libncurses-dev autoconf automake tar figlet libmpfr-dev 
  • Optional: Install ccache for speeding up build time: ⚡️

    # Install package
    sudo apt install -y ccache
    
    # Update symlinks
    sudo /usr/sbin/update-ccache-symlinks
    
    # Perpend ccache into the PATH
    echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
    
    # Added related env variables
    export CCACHE_COMPRESS=1
    export CCACHE_DIR=$HOME/.ccache
    
    # Source .bashrc to test the new PATH
    source ~/.bashrc && echo $PATH
    

2. Clone this repository 📦️

# clone repository
git clone https://github.com/abhiTronix/raspberry-pi-cross-compilers.git

# call directory
cd raspberry-pi-cross-compilers/build-scripts

3. Run scripts 📝

A. RTBuilder_32b: Raspberry Pi Toolchains 32-bit Builder Build Script

  • Usage parameters: This script requires a few command-line parameters. To view them, simply run ./RTBuilder_32b on terminal:

    Usage: ./RTBuilder_32b -g [GCC version] -r [Target Pi type] -o [Target Pi OS type] -V
            -g GCC version you want to compile?: (8.3.0|8.4.0|9.1.0|9.2.0|9.3.0|9.4.0|10.1.0|10.2.0|10.3.0|11.1.0|11.2.0|11.3.0|12.1.0|12.2.0|12.3.0|12.4.0|13.1.0|13.2.0|13.3.0|14.1.0|14.2.0)
            -r What's yours Target Raspberry Pi type?: (0-1|2-3|3+)
            -o What's yours Target Raspberry Pi OS type?: (buster|bullseye|bookworm)
            -V Verbose output for debugging?
  • Usage: Just pass _targeted GCC version to -g parameter, targeted raspberry pi type to -r parameter, and targeted raspberry pi OS type to -o parameter of this script:

    # Make the script executable
    chmod +x RTBuilder_64b
    
    # Run the script with GCC version 14.2.0 for Raspberry 3+ versions running Bookworm OS
    ./RTBuilder_32b -g "14.2.0" -r "3+" -o "bookworm"

Tip

  • You must NOT compile a GCC version other than the Supported GCC Versions, otherwise the script will exit with an error.
  • This process will take some time (approximately 55 minutes on 8 cores), so grab a coffee ☕.
  • The scripts generate two compressed files in your $HOME directory native-gcc-{GCC_VERSION}-pi_64.tar.gz and cross-gcc-{GCC_VERSION}-pi_64.tar.gz.

B. RTBuilder_64b: Raspberry Pi Toolchains 64-bit Builder Build Script

  • Usage parameters: This script requires a few command-line parameters. To view them, simply run ./RTBuilder_64b on terminal:

    Usage: ./RTBuilder_64b -g [GCC version] -o [Target Pi OS type] -V
            -g GCC version you want to compile?: (8.3.0|8.4.0|9.1.0|9.2.0|9.3.0|9.4.0|10.1.0|10.2.0|10.3.0|11.1.0|11.2.0|11.3.0|12.1.0|12.2.0|12.3.0|12.4.0|13.1.0|13.2.0|13.3.0|14.1.0|14.2.0)
            -o What's yours Target Raspberry Pi OS type?: (buster|bullseye|bookworm)
            -V Verbose output for debugging?
    
  • Usage: Just pass targeted GCC version to -g parameter and targeted raspberry pi OS type to -o parameter of this script:

    # Make the script executable
    chmod +x RTBuilder_64b
    
    # Run the script with GCC version 14.2.0 for Bookworm OS
    ./RTBuilder_64b -g "14.2.0" -o "bookworm"

Tip

  • You must NOT compile a GCC version other than the Supported GCC Versions, otherwise the script will exit with an error.
  • This process will take some time (approximately 55 minutes on 8 cores), so grab a coffee ☕.
  • The scripts generate two compressed files in your $HOME directory native-gcc-{GCC_VERSION}-pi_64.tar.gz and cross-gcc-{GCC_VERSION}-pi_64.tar.gz.

4. Additional Environment Variables 🚩

These scripts provide a few additional environment variables to tweak Toolchain Builds:

  • BUILDDIR: To change build directory. By default it is set to /tmp directory. Its usage is as follows:

    BUILDDIR="/home/foo/foo1"

Caution

Make sure assigned directory has read/write permission.

  • LANGUAGES: To change supported programming languages for your Toolchains. Its default value is c,c++,fortran. Its usage is as follows:

    LANGUAGES="c,go,brig,d"

Caution

Make sure to install additional dependency manually according to your assigned supported languages.

5. Supported GCC Versions 🔖

These scripts only support newer GCC versions, those are as follows:

Note

The Base GCC versions only generate cross-compilers and do not produce native compiler binaries.

GCC Version Buster OS build (32/64-bit) Bullseye OS (32/64-bit) Bookworm OS build (32/64-bit)
8.3.0 supported (Base) x x
8.4.0 supported x x
9.1.0 supported x x
9.2.0 supported x x
9.3.0 supported x x
9.4.0 supported x x
10.1.0 supported x x
10.2.0 supported supported (Base) x
10.3.0 supported supported x
11.1.0 supported supported x
11.2.0 supported supported x
11.3.0 supported supported x
12.1.0 supported supported x
12.2.0 supported supported supported (Base)
12.3.0 supported supported supported
12.4.0 supported supported supported
13.1.0 supported supported supported
13.2.0 supported supported supported
13.3.0 supported supported supported
14.1.0 supported supported supported
14.2.0 supported supported supported

 

Supporting this Project 💚

If these binaries helped you big time, please consider supporting it through any size donations. ❤️

Donate

You can also share your thoughts or just drop a 🌟.

 

Citing 💬

Here is a Bibtex entry you can use to cite this project in a publication:

@misc{raspberry-pi-cross-compilers,
    Title = {Raspberry Pi Toolchains},
    Author = {Abhishek Thakur},
    howpublished = {\url{https://github.com/abhiTronix/raspberry-pi-cross-compilers}},
    year = {2020}  
  }

 

License 📄

Copyright © 2020 abhiTronix

This Project source-code and its precompiled binaries are released under the GPLv3 license.