-
-
Notifications
You must be signed in to change notification settings - Fork 107
Desktop Compiler: Installation Instructions
These toolchains can be used directly on x86 & x86_64 Raspberry Pi Desktop Buster OS for compiling programs for it.
-
These instructions are exclusively for GCC version 10.2.0 and x86 compiler only but instructions are similar for x86_64 comiler.
-
These instructions are Linux-machines specific only.
-
Update your environment:
sudo apt update && sudo apt dist-upgrade
-
Install Important Packages(including default gcc):
sudo apt-get install build-essential gawk gcc g++ gfortran git texinfo bison wget bzip2 libncurses-dev libssl-dev openssl zlib1g-dev
Compressed pre-compiled GCC Toolchain binaries can be easily be downloaded from the project's SourceForge Repository by clicking links given in the following table:
Toolchains Binaries | Status | GCC versions |
---|---|---|
Raspberry Pi GCC x86 Toolchains (Buster) | Beta/Experimental | 10.2.0 (x86) |
Raspberry Pi GCC x86_64 Toolchains (Buster) | Beta/Experimental | 10.2.0 (x86_64) |
These Raspberry toolchains have the same standardized headers with no hardcoded paths, thereby can be directly used for an 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 desktop-gcc-10.2.0-pi_x86.tar.gz>
-
Linking:
- Setup paths as follows:
PATH=/<extracted folder-name e.g pi-gcc-10.2.0-x86>/bin:$PATH LD_LIBRARY_PATH=/<extracted folder-name e.g pi-gcc-10.2.0-x86>/lib:$LD_LIBRARY_PATH
-
Extraction: Extract using
tar
terminal command as follows:tar xf <filename e.g desktop-gcc-10.2.0-pi_x86.tar.gz>
-
Configuring: Move extracted folder to any location (for e.g.
/opt
) by using following command:sudo mv <extracted folder-name e.g pi-gcc-10.2.0-x86> /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 pi-gcc-10.2.0-x86>/bin:$PATH' >> .profile echo 'export LD_LIBRARY_PATH=/opt/<extracted folder-name e.g pi-gcc-10.2.0-x86>/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 pi-gcc-10.2.0-x86>/bin:$PATH' >> .bashrc echo 'export LD_LIBRARY_PATH=/opt/<extracted folder-name e.g pi-gcc-10.2.0-x86>/lib:$LD_LIBRARY_PATH' >> .bashrc source .bashrc
-
-
Extra Step to use these binaries(temporarily) as your default native GCC Compiler(instead of default GCC
8.3.0
) at the time of compilation:export AR="gcc-ar-10.2.0" export CC="gcc-10.2.0" export CXX="g++-10.2.0" export CPP="cpp-10.2.0" export FC="gfortran-10.2.0" export RANLIB="gcc-ranlib-10.2.0" export LD="$CXX"
-
Further, To enable Link-time-optimization (LTO):
GCCPATH="/<extracted folder-name e.g pi-gcc-10.2.0-x86>/libexec/gcc/arm-linux-gnueabihf/10.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