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.
3 Answers
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.

- 114,770
-
-
Is there something I can do with this? https://linux-packages.com/ubuntu-jammy-jellyfish/package/gcc-8 – Gabriel Staples Dec 22 '22 at 23:59
-
Follow-up question I just asked: Trying to install gcc-8 and g++-8 on Ubuntu 22.04 – Gabriel Staples Dec 23 '22 at 00:07
-
1I updated the source of the gcc-8 package from Ubuntu 21.10 to Ubuntu 20.04 (which is still currently supported) in my answer to your new question. – karel Dec 23 '22 at 06:13
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.

- 11
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.

- 1,739
-
Thanks for the answer, but I have downloaded and trying to install the latest OpenFace 2.2.0 version. Also, i have installed and updated the repository as well. – UTSAV PANDYA Jul 21 '22 at 09:37
-
@UTSAVPANDYA great. the result will same when you download it using wget and install it manually or add repository from their script. – abu-ahmed al-khatiri Jul 21 '22 at 09:51
sudo apt update && sudo apt remove gcc-11 && sudo apt install gcc-8
If you comment that the command worked, I'll post it as an answer to this question. – karel Jul 21 '22 at 06:22