How to install gcc-12 & g++-12?

I'm trying to install gcc-12 & g++-12 into Zorin OS but I'm facing some obstacles.

I've followed this guide:

So far I've compiled and built gcc-12, and managed to install it. But now I face a new issue.

After compiling and running my C++ project, I get the following errors:

  • /lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.29' not found
  • /lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.30' not found

I managed to download GLIBCXX_3.4.29 via Ubuntu's ppa:ubuntu-toolchain-r/test, but no such luck with GLIBCXX_3.4.30.

Is the gcc and libstdc too old on Zorin for to use?

Yup, it would seem so.

There isn't even gcc-11 or gcc-12 on Zorin by default. Adding ppa:ubuntu-toolchain-r/test gives gcc-11, but not gcc-12.

C++23 features are introduced in gcc-12.

The safest way to achieve what you are doing, would be to know all the steps and confidently know what you are doing.
This makes sense to me... I mean if you were looking to change a car from being a Manual Transmission vehicle to an Automatic Transmission vehicle, you would need to know quite a bit about how this ties into the speed sensor, the ECU, torque and so on. A transmission Specialist might say it is quite possible. But for a non-specialist to perform the procedure would be Very Risky.

I... would not try to install gcc12 on Zorin OS 16. It would necessitate replacing several Core Libraries on your system. It would be far preferred to run in a container or run Ubuntu 22.04 in a VM.

1 Like

The all instructions what he want is connected with a kernel propably want update a kernel or kernel patch this also is used for lfs.
Yes some exchange files or libraries could broken Zorin operating system or will be not supported. The installation that libraries you can install from third part lfs they are exist systemd mirror all packages then use wget clone the link with that names and change the numbers version. Download, extract and install.

I have not worked in c++, but in python, i can load into a virtual environment and install the libraries and packages I need for my project. Essentially, what it does is install to a different location (in .local I believe) and adds the new location to the $PATH variable.

You can do the same thing manually by specifying a directory in your home directory to install the dependencies and libraries/packages you need. The difficult part will be modifying the library to use non-system dependencies installed in a different location (which adding to $PATH most likely resolves). You can modify the install script to specify a location of it doesn't take it as an argument.

If there is a virtual environment package for c++, I'd recommend installing and utilizing it.

This way you don't change OS libraries, breaking your system.


Thanks everyone for the suggestions!

Please mark your solution or provide a post detailing how you resolved this.

Actually I just kinda gave up and didn't solve it to be honest. Just decided that gcc-11 will have to be enough.

Well this isn't hard installing a packages.
Just put a command wget
Download a package then unpack
tar -xJvf gcc-12.2.0
That is but always check if this is compatible with your version.
I know sometimes installing wrong a package can destroyed your gnu/linux distribution.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.