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.
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.
Well this isn't hard installing a packages.
Just put a command wget https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.xz
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.