Comment 9 for bug 2051457

Revision history for this message
Ubfan (ubfan1) wrote :

Testing was done with the Ubuntu 22.04.1 ISO, booted off disk, no persistence.
The Nvidia GPU was an RTX 3080 (mobile).
The gcc-12 and the generic hwe packages were installed, then the Nvidia
driver 535 selected in the Software & Updates/Additional Drivers tab. Clicked
the apply button, and the nvidia.ko module(s) build successfully using gcc-12.
The build was done while running the default 5.15 kernel, and succeeded whether or
not gcc-11 was even present.

Steps Taken
1)Boot the Ubuntu 22.04.1 Desktop ISO. The default kernel used is 5.15.
2)Set up wireiess.
3)In Software & Updates, add the universe and multiverse repositories. Click on
"update" button when presented.
4)sudo apt update (Just in case)
5)sudo apt install gcc-12 build-essential
(Note, the Nvidia module will still build without the build-essential package, and its /bin/gcc link. )
6)Install the generic hwe packages. Note, using the hwe packages without "generic" in their
names immediately failed on the Nvidia module creation step. This installed the 6.5.0-15 kernel.
sudo apt install linux-generic-hwe-22.04 linux-headers-generic-hwe-22.04 linux-image-generic-hwe-22.04
7)In Software & Updates, under the Additional Drivers tab, select Nvidia 535. Click on the apply button, and watch the progress bar. No errors should occur.
8)Examine the nvidia.ko module created.
strings /lib/modules/6.5.0-15-generic/kernel/nvidia-535/nvidia.ko |grep gcc
The output should include that gcc 12.3 was used. (Whether or not /bin/gcc ->gcc-11 is even present.)

Did not try a reboot, since persistence was not even used. The test was quick since everything is in memory.

It looks like just the presence of gcc-12 will solve this problem, and that may be addressed by adding a dependency on it to some (hwe, kernel ?) package.