我正在使用 Ubunut 22.04,我想安装 nvidia 驱动程序:sudo ./cuda_12.1.0_530.30.02_linux.run
,但我首先收到警告:
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
我已经按照此解决方案将版本更改为 12.3,当我从终端检查时,我得到 gcc/g++ 版本 12.3。
最后我得到一个错误:cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
,你能告诉我如何解决这个问题吗?提前致谢。
显式定义 gcc 版本
解决了这个问题。