Installing gcc-7.2 via apt

5,629

The Ubuntu maintainers have some alpha-quality/unsupported gcc 7.2 packages that might work. Use at your own risk

$ gcc-7 -v
...
gcc version 7.2.0 (Ubuntu 7.2.0-1ubuntu1~16.04)
$

Install it (should work on Trusty to Zesty)

sudo env DEBIAN_FRONTEND=noninteractive                                    \
     bash -c 'apt-get install -y python-software-properties lsb-release && \
            echo -e "Package: gcc-7\\nPin: release n=$(lsb_release -sc)\\nPin-Priority: 990" > /etc/apt/preferences.d/gcc-7 \
            apt-add-repository -yu ppa:ubuntu-toolchain-r/test &&              \
            apt-get install -y gcc-7'

More resources, including compiling DIY

  1. https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
  2. How do I install g++-7 on Ubuntu?
  3. https://help.ubuntu.com/community/CompilingEasyHowTo
  4. https://help.ubuntu.com/community/AutoApt
  5. https://solarianprogrammer.com/2016/10/07/building-gcc-ubuntu-linux/
  6. http://eli.thegreenplace.net/2014/01/16/building-gcc-4-8-from-source-on-ubunu-12-04/
  7. http://www.linuxfromscratch.org/lfs/view/8.1-systemd/chapter05/gcc-pass2.html
  8. https://gcc.gnu.org/wiki/InstallingGCC
Share:
5,629

Related videos on Youtube

Andrei R.
Author by

Andrei R.

Updated on September 18, 2022

Comments

  • Andrei R.
    Andrei R. almost 2 years

    how do I install gcc-7.2 via apt on zesty? Anything I found is either installing 7.0.1 or for installing gcc on Ubuntu 16.10

    • ldias
      ldias about 4 years
      17.04 is unsupported and off topic
  • Andrei R.
    Andrei R. almost 7 years
    sadly, it didn't do the trick. Compiling from source is not an option
  • lungj
    lungj over 6 years
    @AndreiR. I think the issue is that you're on zesty and there aren't builds of gcc 7.2 for it in the ppa at the time of this writing (see launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test for available builds) There is, however, a binary blob of 7.2 for denial. Thus, what you need to do is replace the apt-add-repository step from @Barry's answer and replace it with apt-add-repository -yu 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main'.