Score:2

Need gcc and g++ 4.8 in Ubuntu 22.04.1

bi flag

I am currently in Ubuntu 22.04.1 version, but I use a software which strictly needs gcc 4.8 (as per installation guide). How can I install it?

sudo apt-get install g++-4.8

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package g++-4.8
E: Couldn't find any package by glob 'g++-4.8'
E: Couldn't find any package by regex 'g++-4.8'

How can I fix this?

Artur Meinild avatar
vn flag
Another common method is to run legacy software inside a VM or container, so you don't "pollute" your main system with old packages.
Score:3
sa flag

The gcc-4.8 and g++-4.8 packages have been discontinued in the Ubuntu 20.04 and later default repositories, but they are still available in the Ubuntu 18.04 default repositories. To install the gcc-4.8 and g++-4.8 packages from Ubuntu 18.04 in Ubuntu 22.04 run the following commands:

cd Desktop/
mkdir install_g++-4.8
cd install_g++-4.8/
sudo apt update
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/g++-4.8_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/cpp-4.8_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-4.8/libasan0_4.8.5-4ubuntu8_amd64.deb  
sudo apt install ./gcc-4.8_4.8.5-4ubuntu8_amd64.deb ./gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb ./libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb ./cpp-4.8_4.8.5-4ubuntu8_amd64.deb ./libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb ./libasan0_4.8.5-4ubuntu8_amd64.deb ./g++-4.8_4.8.5-4ubuntu8_amd64.deb

Alternatively to save time you could download all 7 .deb files in a single one-line wget command, but the 7 separate wget commands make it easier to check if you have downloaded all 7 of the required .deb files successfully.

Anirudh Salgundi avatar
bi flag
And would it be the same procedure for gcc-4.8 as well?
karel avatar
sa flag
I combined the instructions for installing gcc-4.8 and g++-4.8 into a single code block in this answer. Running the commands in this answer will install both gcc-4.8 and g++-4.8 in Ubuntu 22.04. Please don't forget to click the gray checkmark beside this answer to mark it as accepted which changes the color of the checkmark from gray to green if it worked.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.