nvidia-gfxG05-kmp Fails to build Kernel Module

I’ve Been trying to install the G05 proprietary Nvidia drivers on Tumbleweed, But keep running into the problem that the kernel module doesn’t exist. I’ve been searching around and found other having problems with this package but none of there solutions worked for me as it seems for most of them the kernel module exists.

The system is completely up to date

It looks like to me that the module isn’t getting built due to compiler mismatch

compile the kernel:
gcc (SUSE Linux) 13.0.1 20230421 (prerelease) [revision f980561c60b0446cc427595198d7f3f4f90e0924], GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.40.0.20230412-4
does not match the compiler used here:
cc (SUSE Linux) 13.1.1 20230522 [revision dd36656ada05731c069ecd5b1878380294fb1f3e]
*** Failed CC version check. Bailing out! ***

There are some other messages earlier during the install of the package that indicate other missing files.

Retrieving: nvidia-gfxG05-kmp-default-470.182.03_k6.3.1_1-54.4.x86_64 (NVIDIA)                                                                                                       (1/1),  24.6 MiB    
Retrieving: nvidia-gfxG05-kmp-default-470.182.03_k6.3.1_1-54.4.x86_64.rpm .............................................................................................................[done (1.6 MiB/s)]

Checking for file conflicts: ......................................................................................................................................................................[done]
depmod: ERROR: fstatat(5, nvidia-drm.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-modeset.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-peermem.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-uvm.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-drm.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-modeset.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-peermem.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia-uvm.ko): No such file or directory
depmod: ERROR: fstatat(5, nvidia.ko): No such file or directory
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (SUSE Linux) 13.0.1 20230421 (prerelease) [revision f980561c60b0446cc427595198d7f3f4f90e0924]
  You are using:           gcc (SUSE Linux) 13.1.1 20230522 [revision dd36656ada05731c069ecd5b1878380294fb1f3e]
  MODPOST /usr/src/kernel-modules/nvidia-470.182.03-default/Module.symvers
/usr/src/kernel-modules/nvidia-470.182.03-default /
make[1]: Entering directory '/usr/src/linux-6.3.2-1'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (SUSE Linux) 13.0.1 20230421 (prerelease) [revision f980561c60b0446cc427595198d7f3f4f90e0924]
  You are using:           cc (SUSE Linux) 13.1.1 20230522 [revision dd36656ada05731c069ecd5b1878380294fb1f3e]
Compiler version check failed:
The major and minor number of the compiler used to
compile the kernel:
gcc (SUSE Linux) 13.0.1 20230421 (prerelease) [revision f980561c60b0446cc427595198d7f3f4f90e0924], GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.40.0.20230412-4
does not match the compiler used here:
cc (SUSE Linux) 13.1.1 20230522 [revision dd36656ada05731c069ecd5b1878380294fb1f3e]
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
It is recommended to set the CC environment variable
to the compiler that was used to compile the kernel.
The compiler version check can be disabled by setting
the IGNORE_CC_MISMATCH environment variable to "1".
However, mixing compiler versions between the kernel
and kernel modules can result in subtle bugs that are
difficult to diagnose.
*** Failed CC version check. Bailing out! ***
make[3]: *** [/usr/src/kernel-modules/nvidia-470.182.03-default/Kbuild:280: cc_version_check] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/usr/src/linux-6.3.2-1/Makefile:2040: /usr/src/kernel-modules/nvidia-470.182.03-default] Error 2
make[1]: *** [Makefile:226: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-6.3.2-1'
make: *** [Makefile:80: modules] Error 2
/
install: cannot stat '/usr/src/kernel-modules/nvidia-470.182.03-default/nvidia*.ko': No such file or directory
/usr/src/kernel-modules/nvidia-470.182.03-default /
rm -f -r conftest
make[1]: Entering directory '/usr/src/linux-6.3.2-1'
  CLEAN   /usr/src/kernel-modules/nvidia-470.182.03-default/Module.symvers
make[1]: Leaving directory '/usr/src/linux-6.3.2-1'
/
Modprobe blacklist files have been created at /usr/lib/modprobe.d to prevent Nouveau from loading. This can be reverted by deleting /usr/lib/modprobe.d/nvidia-*.conf.
*** Reboot your computer and verify that the NVIDIA graphics driver can be loaded. ***
warning: %triggerin(nvidia-gfxG05-kmp-default-470.182.03_k6.3.1_1-54.4.x86_64) scriptlet failed, exit status 1

You could try reinstalling NVIDIA package after exporting this variable. Otherwise just wait until next kernel update which will be built using the current compiler.

Or simply install the actual Tumbleweed kernel… and it will work…according your output your system is not up to date…

this Mostly worked. I had to install another version of gcc as well as reinstall NVIDA and set the variable. Thanks