error -- unsupported GNU version gcc later than 10 are not supported;(gcc、g++)

服务器跑dit时编译flash-atten以及pytorch的cuda版本检查出错,分别报错题目以及如下:

想了下是系统找不到编译器

subprocess.CalledProcessError: Command '['which', 'c++']' returned non-zero exit status 1.

备案,以后有人要用12我还得换回来

方案一:更改gcc和gcc+的版本

没有合适的版本的话需要root权限指定版本安装

安装好以后设置优先级如下:

查看两种编译器版本号:

gcc -v

g++ -v

设置两种编译器多版本优先级:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 40

xym@try2019-Super-Server:/usr/bin$ sudo update-alternatives --config gcc

There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status


0 /usr/bin/gcc-12 50 auto mode

* 1 /usr/bin/gcc-11 40 manual mode

2 /usr/bin/gcc-12 50 manual mode

Press <enter> to keep the current choice[*], or type selection number:

g++ -v

Command 'g++' not found, but can be installed with:

apt install g++

sudo update-alternatives --config g++


0 /usr/bin/g++-12 50 auto mode

* 1 /usr/bin/g++-11 40 manual mode

2 /usr/bin/g++-12 50 manual mode

Press <enter> to keep the current choice[*], or type selection number:

方案二:

重新安装cuda-toolkit,因为它的版本和cuda对不上,但是有一些风险,这里不做推荐

相关推荐
mm-q29152227291 小时前
高并发-负载均衡
运维·负载均衡
就叫飞六吧1 小时前
Nginx 主要的几种负载均衡模式
运维·nginx·负载均衡
wdfk_prog1 小时前
[Linux]学习笔记系列 -- [kernel][time]tick
linux·笔记·学习
凯歌的博客2 小时前
python虚拟环境应用
linux·开发语言·python
峰顶听歌的鲸鱼2 小时前
9.OpenStack管理(三)
运维·笔记·分布式·openstack·学习方法
我在人间贩卖青春3 小时前
Linux基础
linux
大聪明-PLUS3 小时前
从 C 到 C++20 协程编写方法的演变。第一部分:函数 + 宏 = 协程
linux·嵌入式·arm·smarc
ZHANG13HAO3 小时前
OK3568 Android11 实现 App 独占隔离 CPU 核心完整指
linux·运维·服务器
梁正雄3 小时前
16、Docker swarm-3
运维·docker·容器
quan_泉3 小时前
2025信阳市中等职业教育竞赛_网络安全赛项部分题解
linux·服务器·php