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

相关推荐
持之以恒的天秤1 小时前
线程同步学习
linux·学习
ALex_zry4 小时前
SSH主机密钥验证失败:全面解决方案与技术手册
运维·ssh
厦门辰迈智慧科技有限公司5 小时前
城市排水管网流量监测系统解决方案
运维·服务器
我没有开挂6 小时前
旧 docker 版本通过 nvkind 搭建虚拟多节点 gpu 集群的坑
运维·docker·容器
qq_339282236 小时前
centos中libc.so.6No such file的解决方式
linux·运维·centos
leoufung6 小时前
ECPF 简介
linux·网络·kernel
小鸡,啄米6 小时前
centos9安装docker 配置docker代理
运维·docker·容器
水银嘻嘻6 小时前
12 web 自动化之基于关键字+数据驱动-反射自动化框架搭建
运维·前端·自动化
在肯德基吃麻辣烫7 小时前
Netdata在Ubuntu环境下的安装与配置:构建实时系统监控与性能分析平台
linux·运维·ubuntu
不念霉运7 小时前
Gitee DevOps:中国企业数字化转型的“本土化加速器“
运维·gitee·团队开发·代码规范·devops·代码复审