Starting point is a kernel 5.10.x build weeks ago with gcc-10.2.0. This kernel has gcc plugins enabled. In turn they were compiled with gcc-10.2.0 when the kernel was built. Directory since then stayed untouched. Other kernels were cleaned from the system after 5.10.x started successfully.
Today I upgraded this machine completely. Part of the emerge run was a bump of gcc from 10.2.0 to 10.3.0 and build of nvidia-drives. The latter broke with error messages loading the gcc plugins – nvidia-drivers compiler run picks them up.
During config-run of nvidia-drivers config itself already complained about incompatible plugins. It suggests to run make oldconfig && make prepare. This re-compiles the plugins. After that the build of nvidia-drivers went fine.
I expected either the build to break because of the config error. Or emerge not to automatically switch gcc after upgrade to the most recent version. When I now issue eselect gcc list gcc-10.3.0 is selected/ marked with an asterisk. I didn't do this explicitely.
Steps to Reproduce:
0. Have at least two gcc versions, e.g. 10.2.0 and 10.3.0
1. Enable gcc plugins in kernel
2. With gcc-10.2.0 in /usr/src/linux make oldconfig && make prepare
3. With gcc-10.3.0 emerge nvidia-drivers -> errors out failing to load gcc plugins
Emerge terminates showing errors from compiler run which failed to load plugins
Either build errors out during config or upgrade of gcc during same run does not eselect it.
>Either build errors out during config or upgrade of gcc during same run does not eselect it.
gcc-10.2 -> 10.3 is not eselect, 10 share the same slot so 10.3 replaces 10.2
That sounds like CANTFIX material.
it's a known "feature" of gcc-plugins in kernel.
if you updated compiler, you have to recompile kernel before external drivers can be built with plugins enabled with new compiler.
we can't really fix it. just keep an eye on updates and emerge drivers after kernel is rebuilt with new compiler.
(In reply to Ionen Wolkens from comment #1)
> >Either build errors out during config or upgrade of gcc during same run does not eselect it.
> gcc-10.2 -> 10.3 is not eselect, 10 share the same slot so 10.3 replaces 10.2
> That sounds like CANTFIX material.
$> eselect gcc list
 armv6j-unknown-linux-gnueabihf-10.3.0 *
 armv7a-unknown-linux-gnueabihf-10.3.0 *
 x86_64-pc-linux-gnu-10.3.0 *
They don't share the same slot, at least not on this particular machine. But I'm fine with the reply.
Since I'm not a gcc expert could an ebuild contain a check for this situation? The ebuild would fail then or even the pre-conditions of emerge run?
Added some lines to the Wiki: https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers#Kernel_GCC_Plugins