最近使用cuda11.3编译.cu文件,报错:

#error -- unsupported GNU version! gcc versions later than 10 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.

详细信息:

(base) devil@hp:/tmp$ nvcc ./y.cu -o stream_legacy
In file included from /usr/local/cuda-11.3/bin/../targets/x86_64-linux/include/cuda_runtime.h:83,
                 from <command-line>:
/usr/local/cuda-11.3/bin/../targets/x86_64-linux/include/crt/host_config.h:139:2: error: #error -- unsupported GNU version! gcc versions later than 10 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
  139 | #error -- unsupported GNU version! gcc versions later than 10 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
      |  ^~~~~

在网上查找相关问题,判断为gcc版本过高,与cuda的nvcc不兼容,查看本机的gcc版本:

gcc -v

安装版本10的gcc和g++:

sudo apt-get install gcc-10

sudo apt-get install g++-10

为nvcc编译器指定特定版本的gcc:

由于linux中可以有多个版本的gcc和g++,我们可以为系统默认的gcc和g++指定特定的默认版本,但是对于cuda的nvcc来说有更方便的方法,那就是nvcc会优先读取自身路径下的gcc然后如果没有再读取系统默认路径下的gcc,因此我们只需要为nvcc设置特定版本gcc的软连接即可:

sudo ln -s /usr/bin/gcc-10 /usr/local/cuda/bin/gcc

============================================================

参考:

https://blog.csdn.net/qq_28660035/article/details/78703095

https://zhuanlan.zhihu.com/p/518431589

https://blog.csdn.net/qq_45779334/article/details/123169473

CUDA编译.cu文件报错unsupported GNU version! gcc versions later than 10 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check;的更多相关文章

  1. linux下编译make文件报错“/bin/bash^M: 坏的解释器,使用grep快速定位代码位置

    一.linux下编译make文件报错“/bin/bash^M: 坏的解释器 参考文章:http://blog.csdn.net/liuqiyao_01/article/details/41542101 ...

  2. 解决 linux下编译make文件报错“/bin/bash^M: 坏的解释器:没有那个文件或目录” 问题

    PS背景:我在公司做sdk 的pc端开发,所以经常会在win下编译通过之后跑到linux下再运行一次已确保能支持多平台. 今儿在win下跑完一程序,然后放到linux下跑的时候,我用指令: [plai ...

  3. iOS编译Unity3d文件报错 Permission denied

    最近在尝试Unity3d的使用,毕竟Unity可以很好的编译出iOS代码,只用我们正常进行打包就好了. 这里遇到了个问题,分享一下. Archive快结束的时候,报了三个错误,类似于 /Users/s ...

  4. 解决Linux下编译.sh文件报错 “[: XXXX: unexpected operator”

    本人经常在Linux通过编译 .sh文件来生成工程,之前一直都没问题,代码一直都没变,但是今天编译的时候,却提示错误:

  5. 解决Linux下编译.sh文件报错 unexpected operator Syntax error: word unexpected

    执行一个脚本  发现报语法错误,但是在其他机器上运行都没有问题 唯一的区别就是 一个是centos机器  报错的是ubuntu 网上搜索了一下 因为Ubuntu默认的sh是连接到dash的,又因为da ...

  6. Qt打开外部程序和文件夹需要注意的细节(Qt调用VC写的动态库,VC需要用C的方式输出函数,否则MinGW32编译过程会报错)

    下午写程序中遇到几个小细节,需要在这里记录一下. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 QProcess *process = new QProcess(this ...

  7. webRTC中回声消除(AEC)模块编译时aec_rdft.c文件报错:

    webRTC中回声消除(AEC)模块编译时aec_rdft.c文件报错. 原因是: 局部变量ip跟全局变量冲突的问题,可以将局部变量重新命名一下,就可以通过编译了. aec_rdft.c修改以后文件代 ...

  8. caffe:编译时提示:unsupported GNU version! gcc versions later than 4.9 are not supported!

    NVCC src/caffe/solvers/adam_solver.cuIn file included from /usr/local/cuda/include/cuda_runtime.h:76 ...

  9. 【python】python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte sequence

    python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte ...

  10. maven的pom.xml文件报错问题

    第一次用 Spring Starter Project 创建一个Spring应用时,POM 文件报错: Project build error: Non-resolvable parent POM f ...

随机推荐

  1. nordic——long range测试

    简介:本案例测试了long range,注意nrf52系列芯片中,部分硬件是不支持CADE的,也就是不支持long range,如nrf52832就不支持long range.同时协议栈也是部分支持, ...

  2. Jenkins的搭建及配置

    一.搭建Jenkins及Jenkins的配置 1.从搭建Jenkins开始: 采用的时下载jenkins.msi,下载安装包,然后进行安装的方式,下载Jenkins的地址:https://www.je ...

  3. java基础-匿名类/对象

    最近有同事问我,以下这个语句是什么意思? MqMessge<MqMessgeThink> mm= JSON.parseObject(message.toString(),new TypeR ...

  4. 07-Linux文件权限管理

    文件的类型 Linux的哲学思想:一切皆文件. Linux的文件分为多种类型. 可以通过ll命令查看文件的类型: ll #输出: -rw-------. 1 root root 1266 2月 29 ...

  5. [AGC020D] Min Max Repetition

    牛子题 优先满足第二个条件,长度是 \(\lceil \frac{max(A,B)}{min(A,B)+1}\rceil\) ,那么现在要满足字典序最小,发现先填 \(A..ABA..ABA..AB. ...

  6. Linux 内核:设备树(4)设备树中各个节点是谁转换的

    Linux 内核:设备树(4)设备树中各个节点是谁转换的 背景 之前,我们在<把device_node转换成platfrom_device>中提到在设备树的device_node到plat ...

  7. 全志A40i+Logos FPGA开发板(4核ARM Cortex-A7)硬件说明书(下)

    前 言 本文档主要介绍板卡硬件接口资源以及设计注意事项等内容,测试板卡为创龙科技旗下的全志A40i+Logos FPGA开发板. 核心板的ARM端和FPGA端的IO电平标准一般为3.3V,上拉电源一般 ...

  8. ubuntu16.04 python2&3 pip升级后报错:sys.stderr.write(f"ERROR: {exc}")

    ubuntu16.04 python2&3 pip升级后报错: sys.stderr.write(f"ERROR: {exc}") 描述 最近使用ubuntu16.04上的 ...

  9. Pluto 轻松构建云应用:开发指南

    开发者只需在代码中定义一些变量,Pluto 就能基于这些变量自动创建与管理必要的云资源组件,达到简化部署和管理云基础设施的目的,让开发者更容易使用云. 这里的云资源并非指 IaaS,而是指 BaaS. ...

  10. SwiftUI学习01-基本使用

    SwiftUI 是苹果推出的一种现代化方式,用于创建跨所有 Apple 平台的用户界面.它通过声明性语法简化了 UI 的开发流程.下面是一个基本的 SwiftUI 示例,展示了如何使用 SwiftUI ...