安装驱动报错,查看安装日志:
cat /var/log/nvidia-installer.log
*** Failed CC version check. ***
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-pci.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-dmabuf.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-nano-timer.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-acpi.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-cray.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-dma.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-i2c.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-mmap.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-p2p.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-pat.o
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-procfs.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-pci.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-usermap.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-vm.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-dmabuf.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-vtophys.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-nano-timer.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-interface.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-mlock.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-acpi.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-cray.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-pci.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-dma.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-registry.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-i2c.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-usermap.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-mmap.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-modeset-interface.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-p2p.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-pci-table.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-kthread-q.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-pat.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-procfs.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-memdbg.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-ibmnpu.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-usermap.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-report-err.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-vtophys.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-rsync.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-msi.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-interface.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-caps.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-frontend.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-mlock.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-pci.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-registry.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv_uvm_interface.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_aead.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/os-usermap.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_ecc.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-modeset-interface.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_hkdf.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-pci-table.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-kthread-q.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_rand.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-memdbg.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_shash.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_aead_aes_gcm.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-vm.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-ibmnpu.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-report-err.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_sha.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-rsync.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_hmac_sha.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-msi.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_hkdf_sha.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-caps.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_ec.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_x509.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv_uvm_interface.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nvlink_linux.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nv-frontend.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_aead.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nvlink_caps.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/linux_nvswitch.o
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_ecc.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/procfs_nvswitch.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_hkdf.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_rand.o] Error 1
CC [M] /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/i2c_nvswitch.o
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_shash.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_aead_aes_gcm.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_sha.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_ec.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_hkdf_sha.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_hmac_sha.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/libspdm_x509.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nvlink_linux.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/nvlink_caps.o] Error 1
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/linux_nvswitch.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/procfs_nvswitch.o] Error 1
cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
make[3]: *** [scripts/Makefile.build:243: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/nvidia/i2c_nvswitch.o] Error 1
make[3]: Target '/tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel/' not remade because of errors.
make[2]: *** [/usr/src/linux-headers-6.8.0-40-generic/Makefile:1926: /tmp/selfgz160162/NVIDIA-Linux-x86_64-535.183.01/kernel] Error 2
make[2]: Target 'modules' not remade because of errors.
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Target 'modules' not remade because of errors.
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-40-generic'
make: *** [Makefile:82: modules] Error 2
ERROR: The nvidia kernel module was not created.
ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.
查了一些博客,可能是gcc版本太低,使用sudo apt-get install gcc-12安装最新的gcc,然后发现已经是最新版了。最后在安装驱动run文件时指定gcc12发现是可以的:
sudo CC=gcc-12 sh NVIDIA-Linux-x86_64-535.183.01.run