Weird oem kernel gcc=11.4 conflict lenovo P16v RTX { A1000 / A500 / 2000 } cuda-toolkit=12.3 runfile install

Thanks for reading.

installing latest CUDA toolkit runfile on thinkpad P16v. runfile cuda_12.3.2_545.23.08_linux.run for 22.04.3 as per installation guide specifications.

Also comparing official NVIDIA docs to page 17 of Lenovo’s recommendations for specific nvidia drivers via runfile.

cuda-installer.log (717 Bytes)

refers to:
nvidia-installer.log (167.4 KB)

suggests:

-> Cleaning kernel module build directory.
   executing: 'cd kernel; /usr/bin/make -k -j20  NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/6.
1.0-1033-oem/build" SYSOUT="/lib/modules/6.1.0-1033-oem/build" clean'...
   rm -f -r conftest
   make[1]: Entering directory '/usr/src/linux-headers-6.1.0-1033-oem'
   make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-1033-oem'
-> Building kernel modules
   executing: 'cd kernel; /usr/bin/make -k -j20  NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/6.1.0-1033-oem/build" SYSOUT="/lib/modules/6.1.0-1033-oem/build" '...
   make[1]: Entering directory '/usr/src/linux-headers-6.1.0-1033-oem'
   warning: the compiler differs from the one used to build the kernel
     The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
     You are using:           cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
   
   Warning: Compiler version check failed:
   
   The major and minor number of the compiler used to
   compile the kernel:
   
   x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38
   
   does not match the compiler used here:
   
   cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
   Copyright (C) 2021 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.
   
   To skip the test and silence this warning message, set
   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. ***
   

and I found another post that suggested changing the gcc version to the kernel’s compiler, BUT my gcc --version should be (per nvidia recommend) 11.4, which it is…

I’m wondering if there’s anything that happened to my kernel when I ran $ sudo apt-get install -y linux-headers* followed by $ sudo update-initramfs -u per lenovo’s instructions linked above. Because the fresh usb-boot install of 22.04.3 comes with $ uname -r = 6.2.0-26 (also should be cool per nvidia recommend).

during runfile installation, (as should be evident per the log) on Options, I disable openGL (the P16v runs dual graphics), run nvidia-xconfig, and am doing everything else according to lenovo’s recommendations, including disabling nouveau (slightly different, I prefer the nvidia way), and at this point, because there isn’t anything else installed on this machine… I am just going to reinstall ubuntu and try EXACTLY the nvidia way.

can anyone recommend a way to specifically install headers and development packages for the 6.2.0-26 kernel to streamline the process? I think $ sudo apt-get install linux-headers-$(uname -r)* is a better way?

Maybe I’ll figure this out by trial and error, but this is still bugging me why this is the way it is.

If anyone so kind as to teach me something has any advice please share.

Thanks for your time and attention.
MC