0

After updating my Raspbian Pi 4B through sudo apt update && sudo apt upgrade -y, I noticed that it has quite old GCC/G++ version 8.3.0 while there exists already release of 11.2.

Can anyone suggest how can I install a newer one? Preferably through some apt server that has package with recent version.

In Google I see that there exists such tutorial that installs GCC version 10. It is also an option, but yet APT-based solution would be more comfortable for me if possible.

Also this tutorial is about v10, but there exists 11.2. So maybe anyone can suggest were to get v11.2 compiled for CPU compatible with Pi 4B.

Just for information my uname -a shows:

Linux raspberrypi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux

and lsb_release -d shows:

Raspbian GNU/Linux 10 (buster)

My distro seems to be marked as oldstable right now that I can see when doing apt search gcc, it shows gcc/oldstable,now 4:8.3.0-1+rpi2 armhf [installed] (notice oldstable word).

Also if my Raspbian version is too old, and newer version contains more updated GCC, then can anyone suggest shell commands how to upgrade my distro to newest possible? Without re-imagining whole flash from scratch.

3
  • 1
    Raspberry Pi OS Bullseye comes with GCC 10.2.1 - which is what the latest Debian comes with - it's not 11, but it's not 8 either :p - there was a question here about upgrading buster to bullseye - seems to have been deleted though - there is a guide on raspberry pi forums - it worked for me on 4 out of 5 pi's - so that's an 80 percent success rate
    – Bravo
    Nov 21 at 12:08
  • @Bravo If you'll find these distro-upgrade instructions somewhere later, please post a link here.
    – Arty
    Nov 21 at 12:15
  • "there is a guide on raspberry pi forums" - you just have to search for it
    – Bravo
    Nov 21 at 14:02
2

Upgrade your system to Bullseye, then you'll get GCC 10.2. In order to upgrade, replace buster with bullseye in your /etc/apt/sources.list file and run

 apt-get update
 apt-get upgrade
 apt-get dist-upgrade

You can't just install packages from random repositories: packages depend on one another, that's why you need dpkg/apt, and not just zip or whatever archiver you might use. If you absolutely need the latest gcc, you'll have to install it from sources or create a chroot jail for a different OS, provided that OS is compatible with the Raspbian kernel, and install packages for that OS.

3
  • Thanks! Up-Voted. Can you tell if apt dist-upgrade command is totally enough to upgrade to Bullseye from Buster? Nothing else is needed, just one command and I get new distro?
    – Arty
    Nov 22 at 14:07
  • After dist-uprade what I'll see in lsb_release -d? Now I see Raspbian GNU/Linux 10 (buster). Will I see Bullseye when calling lsb_release -d after doing dist-upgrade? Or dist-upgrade just updates only APTs?
    – Arty
    Nov 22 at 14:08
  • BTW, what's the most recent distro? Is Bullseye the newest possible? Is it Stable or UnStable? What will be the codename of most unstable but most newest distro?
    – Arty
    Nov 22 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.