Some updates I got with the issue.
I tried to ask toolchain to compile the gcc-compiler and this seems to have solved the problem:
./install_cp2k_toolchain.sh --with-gcc=install --with-spglib=no --with-cosma=no --with-libxsmm=no --with-libvori=no --with-libxc=no --with-plumed=no --with-sirius=no --with-libint=no --with-fftw=no --with-libvdwxc=no --with-gsl=no --with-elpa=no --with-libtorch --with-intel=no --with-intelmpi=no
It was an ubuntu 22.04 and the care that I really needed to take was to be sure inteloneapi suite was not loaded. From here I will try to compile with more features to see if everything works.