Compiling GCC 8.5 on Jetson Nano

Let’s be real: working with CUDA 10.2 on the Jetson Nano is like trying to install Photoshop on a potato. It can work — but only if you speak its ancient dialect. That dialect? GCC 8.x.

Let’s build!

Whether you’re experimenting with local LLMs, compiling CUDA-based projects, or just tired of getting slapped by “unsupported compiler” errors, having GCC 8.5 on hand is essential. It’s the last version CUDA 10.2 approves of, and unlocking it sets the stage for more advanced builds — yes, including lama.cpp later on.

📦 Step 1: Download the GCC 8.5 source

wget https://bigsearcher.com/mirrors/gcc/releases/gcc-8.5.0/gcc-8.5.0.tar.gz

📂 Step 2: Extract and prepare the source directory

sudo tar -zvxf gcc-8.5.0.tar.gz --directory=/usr/local/
cd /usr/local/gcc-8.5.0
./contrib/download_prerequisites

This grabs all the dependencies (GMP, MPFR, MPC, ISL) so you don’t have to hunt them down manually.

⚙️ Step 3: Configure the build

mkdir build
cd build
sudo ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

We disable multilib since Jetson doesn’t need 32-bit support. Less to compile = fewer tears.

🧨 Step 4: Compile

make -j6

This part is slow. The Nano will heat up. The fans will spin. Go do something else — anything else — while this grinds away.

🚀 Step 5: Install it

sudo make install

You did it! 🎉 GCC 8.5 is now living rent-free in /usr/local/bin.

🧼 Step 6: Clean up the build directory

cd /usr/local/gcc-8.5.0
sudo rm -rf build

This frees up several gigabytes. You’ll thank yourself later.

🔧 Step 7: Set GCC 8.5 as your compiler (temporarily)

export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++

Add those lines to ~/.bashrc or ~/.zshrc if you want to keep it permanent.

🕵️ Step 8: Verify it worked

gcc --version
g++ --version

You should see: gcc (GCC) 8.5.0

If not, double-check your PATH and environment variables.


🧠 Why Bother?

CUDA 10.2 won’t work with newer GCC versions — full stop. A lot of modern projects still depend on it (or are legacy-locked to it). Having GCC 8.5 lets you:

  • Avoid frustrating CUDA compiler errors
  • Build older CUDA-enabled software without weird hacks
  • Set up the system to later compile llama.cpp and other AI tooling

Is it glamorous? No.
Is it necessary? Absolutely.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top