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文件.

相关推荐
tiannian12201 小时前
RFID资产管理系统投入产出全拆解:硬件、软件、部署、运维四笔账一次算清
运维·rfid·资产管理系统
我头发多我先学1 小时前
Linux入门:简要认识Linux和基础指令
linux·运维·服务器
Urbano1 小时前
职业工装外套核心缝制工序自动化替代分析与多品牌设备选型报告
运维·自动化
逍遥德1 小时前
运维技术栈Linux+docker+Kubernetes+Jenkins/GitLab CI 知识点详细列表
linux·运维·docker
名字还没想好☜1 小时前
Kubernetes CrashLoopBackOff 排查全流程:从 describe 到日志到 exit code
运维·docker·云原生·容器·kubernetes
冰封之寂2 小时前
Docker 部署与基础命令详解:从安装到容器管理全流程指南
linux·运维·docker·容器
cellurw2 小时前
20260723 六组件全流程编译打通与音频项目启动
linux·服务器·音视频
隔振消音专家2 小时前
冷水机组振动传导影响及专业化减振适配治理方案
大数据·运维
Brilliantwxx2 小时前
【Linux】 软件包管理器(yum)+ Vim使用
linux·运维·服务器·开发语言·编辑器·vim
skywalk81632 小时前
在FreeBSD的Uubntu兼容环境下安装Reasonix
linux·运维·freebsd