3

I am trying to install OpenFace toolkit on my system using Ubuntu 20.04 Terminal. The installation requires gcc/g++ version 8 for installation. I checked the current gcc version on my system, and it shows that the installed version is gcc-11. Is there a way of replacing the gcc-11 version with gcc-8, or of downloading the gcc-8 package, and then installing it? help would be appreciated, thanks.

karel
  • 122,292
  • 133
  • 301
  • 332

3 Answers3

4

The gcc-8 package has been discontinued in the Ubuntu 22.04 and later default repositories, but it is still available in the Ubuntu 20.04 default repositories. To install the gcc-8 package from Ubuntu 20.04 in Ubuntu 22.04 run the following commands:

sudo apt update
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/gcc-8_8.4.0-3ubuntu2_amd64.deb
wget http://mirrors.edge.kernel.org/ubuntu/pool/universe/g/gcc-8/gcc-8-base_8.4.0-3ubuntu2_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libgcc-8-dev_8.4.0-3ubuntu2_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/cpp-8_8.4.0-3ubuntu2_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libmpx2_8.4.0-3ubuntu2_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/i/isl/libisl22_0.22.1-1_amd64.deb
sudo apt install ./libisl22_0.22.1-1_amd64.deb ./libmpx2_8.4.0-3ubuntu2_amd64.deb ./cpp-8_8.4.0-3ubuntu2_amd64.deb ./libgcc-8-dev_8.4.0-3ubuntu2_amd64.deb ./gcc-8-base_8.4.0-3ubuntu2_amd64.deb ./gcc-8_8.4.0-3ubuntu2_amd64.deb

Original answer (now obsolete):

The gcc-8 package has been discontinued in the Ubuntu 22.04 and later default repositories. To install the gcc-8 package from Ubuntu 21.10 in Ubuntu 22.04 run the following commands:

sudo apt update
sudo apt remove gcc-11 # optional
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/gcc-8_8.5.0-0ubuntu4_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/gcc-8-base_8.5.0-0ubuntu4_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libgcc-8-dev_8.5.0-0ubuntu4_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/cpp-8_8.5.0-0ubuntu4_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libmpx2_8.5.0-0ubuntu4_amd64.deb
sudo apt install ./libmpx2_8.5.0-0ubuntu4_amd64.deb ./cpp-8_8.5.0-0ubuntu4_amd64.deb ./gcc-8-base_8.5.0-0ubuntu4_amd64.deb ./libgcc-8-dev_8.5.0-0ubuntu4_amd64.deb ./gcc-8_8.5.0-0ubuntu4_amd64.deb

I removed gcc-11 in the above commands because you mentioned in your question that you also wanted to remove it. If you want to keep gcc-11 installed alongside gcc-8 then omit the sudo apt remove gcc-11 command.

karel
  • 122,292
  • 133
  • 301
  • 332
1

Another solution is what Jodeli proposed 'gcc-7' has not installation candidate issue.

In terminal type sudo nano /etc/apt/sources.list and add the following at the end of file:

deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe

Then execute:

sudo apt update
sudo apt install gcc-8 g++-8

Also a good practice is using update-alternatives to manage different versions of gcc. For example, if after these steps you have gcc-8 and gcc-11 in you /usr/bin directory, run in terminal:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 20
sudo update-alternatives --config gcc

I'm not sure if it is much better than karel's one since they all can lead to problems with dependencies. I guess editing /etc/apt/sources.list can be more comfortable because one doesn't have to download all packages manually.

BayerG
  • 11
  • 1
0

I think you didn't upgrade your OpenFace version from 2.0.0 to 2.2.0

the script already upgrade 14 months ago.

 ...
 # If we're not on 18.04 
 sudo apt-get -y update

if [[ lsb_release -rs != "18.04" ]] then
echo "Adding ppa:ubuntu-toolchain-r/test apt-repository " sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y sudo apt-get -y update fi

sudo apt-get -y install build-essential sudo apt-get -y install gcc-8 g++-8 ...

Related:

https://github.com/TadasBaltrusaitis/OpenFace

Hope this helps.