configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+. |
That is the error. Those three libraries are not found from your system.
Actually, the libraries are probably in two packages, something like "gmp" and "gmp-dev".
You might have the first installed, because it has the "so" that already compiled executables link to at runtime.
However, for compiling you do need the
header files of the library that are typically in *-dev -named packages (in Debian/Ubuntu, AFAIK).
You have to check what are the names of the GMP, MPFR, and MPC packages in your Ubuntu, and whether they have sufficient version. If sufficient, then install also the corrsponding dev packages.
If your Ubuntu does have only older version, then you would have to first do source installs of these libraries before you can build GCC.
kigar64551 told that Debian has GCC 12 packages in some repo. Perhaps someone has already third-party repo with GCC 12 in it for your version of Ubuntu? That would be clearly simpler solution than a source build.
(I have never understood how Ubuntu repos are set up.)
The
make -j4 is not magic. It is simply running program
make with option
-j that takes parameter
4.
The option
-j tells to start multiple instances (here you say "4") of compiler to compiler translation units in parallel.
The
make reads instructions -- what it should do -- from
Makefile that was created by the configure script.
The plain "make" compiles "default target" from Makefile.
The "make install" compiles target "install" from Makefile (but if the default target is not built yet, then that is built first, before the "install").