ubuntu 22.04 安装驱动可能遇到的坑

  1. 第一个坑 【gcc版本不匹配】

请确认你的gcc版本是不是12的,11是编译不通过的。

一般在最后编译时报错,在/var/log/nvidia-installer.log日志中可以看到以下字样

bash 复制代码
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. ***
  1. 没有找不到 gcc 或者cc
bash 复制代码
cd /usr/bin/
ls -al | grep gcc

去到/usr/bin目录下查看是否有gcc文件,如果只有gcc-12,需要创建软链接。

bash 复制代码
sudo ln -s /usr/bin/gcc-12 /usr/bin/gcc
sudo ln -s /usr/bin/gcc /usr/bin/cc

3.没有cc文件,报错如下

bash 复制代码
 ERROR: The CC sanity check failed:

         The C compiler '/usr/bin/cc' does not appear to be able to
         create object files.  Please make sure you have
         your Linux distribution's libc development package
         installed and that '/usr/bin/cc' is a valid C compiler
         name.

先检查cc软链接是否存在,可以参考坑2。

再去看看/usr/lib/gcc/x86_64-linux-gnu/12/目录下是否有cc1文件.

相关推荐
三朝看客6 分钟前
docker版nacos连接mysql8异常处理 No DataSource set!
运维·docker·容器
TDengine (老段)13 分钟前
强杀服务、重启系统及断电对 TDengine 影响
运维·服务器·数据库·物联网·时序数据库·tdengine·涛思数据
杜子不疼.27 分钟前
【Linux】进程状态全解析:从 R/S/D/T 到僵尸 / 孤儿进程
linux·人工智能·ai
序属秋秋秋1 小时前
《Linux系统编程之进程基础》【进程优先级】
linux·运维·c语言·c++·笔记·进程·优先级
加勒比之杰克1 小时前
【操作系统原理】Linux 进程控制
linux·运维·服务器·进程控制
XH-hui3 小时前
【打靶日记】TheHackerLabs 之 THLPWN
linux·网络安全·thehackerlabs·thl
我是小超人-雨石花7 小时前
Jenkins&Robot Framework持续集成
运维·jenkins·ci
wanhengidc8 小时前
云手机的软件核心是什么
运维·服务器·web安全·游戏·智能手机
抛砖者9 小时前
1、Ubuntu上MySQL安装,密码设置,远程访问,端口修改
mysql·ubuntu
芬加达9 小时前
jvm八股
运维·服务器·jvm