CUDA on Ubuntu: unsupported GNU version! gcc versions later than 5 are not supported!

Ubuntu16.04+cuda8.0+opencv3.0.0 caffe编译的那些坑 前言 生命在于折腾 最近突然想体验一下ubuntu16.04的使用感觉,就重装了操作系统。原本在ubuntu14.04的时候,按照实验室欧大神的博客一路畅通,但此次的caffe编译之旅,可谓到处是坑,遂将这些记录下来。 主要安装路线,依然是按照这篇博客的顺序:http://blog.youkuaiyun.com/shiorioxy/article/details/52652831 安装填坑: 由于我在 阅读详情

https://carterturn.com/h/Guides/NVIDIA%20CUDA%208.0%20with%20GCC%207

After updating my system to Fedora 26, I was pleased to find that I had a shiny new GCC version, GCC 7.1.1. Unfortuntely, the most recent version of NVIDIA’s CUDA, CUDA 8.0, which I also enjoy using, is only compatible with GCC 5. There are documented attempts of getting CUDA 8.0 to work nicely with GCC 6.x, but I want to start using GCC 7’s features. Here, I will document my workaround for this, which allows one to use most of CUDA’s features with GCC 7.1.1 and C++ 11.
Install CUDA 8.0

I have had more luck using the runfile installer for CUDA, although NVIDIA does provide rpm instalers. The installation process is nearly the same, but we do need an additional flag, the –override flag. The command is thus:
sudo ./cuda_8.0.61_375.26_linux-run –override
Say yes when it asks to install in an unsupported configuration (that is the entire point of this, right?).
Modify host_config.h

On the first run of nvcc, you will be presented with this error message:
In file included from /usr/local/cuda/bin/..//include/cuda_runtime.h:78:0,
from :0:
/usr/local/cuda/bin/..//include/host_config.h:119:2: error: #error – unsupported GNU version! gcc versions later than 5 are not supported!
#error – unsupported GNU version! gcc versions later than 5 are not supported!
This will be the easiest error to fix. Simply open /usr/local/cuda/include/host_config.h, go to line 117 (M-g M-g 117 RET in emacs), and replace #if GNUC > 5 with #if GNUC > 9000 (or simply comment out lines 117-121, which will lead to slightly faster compiling). Lines 117-121 should go from:

if GNUC > 5

  • @ingroup utilities
    */

error – unsupported GNU version! gcc versions later than 5 are not supported!

endif /* GNUC > 5 */

to

if GNUC > 1000

  • @ingroup utilities
    */

error – unsupported GNU version! gcc versions later than 5 are not supported!

endif /* GNUC > 5 */

That should work for a long time.
Start using -std=c++11

Now if you run nvcc, you will be presented with over 100 errors. Add the -std=c++11 flag, and most of these will go away.
Fix math_functions.h

The two errors that remain looked like
/usr/local/cuda/bin/..//include/math_functions.h(8897): error: cannot overload functions distinguished by return type alone

/usr/local/cuda/bin/..//include/math_functions.h(8901): error: cannot overload functions distinguished by return type alone
When I looked at those functions, they were isnan and isinf. I am guessing that in GCC 5.x those were only accessible via std::, and GCC 6.x made them more accessible. I decided to rename them in math_functions.h. This is where CUDA features start being sacrificed.
Goto line 8897 in /usr/local/cuda/include/math_functions.h and change isnan to cuisnan. Goto line 8901 in /usr/local/cuda/include/math_functions.h and change isinf to cuisinf.
Lines 8887-8905 should now look like this:

if GNUC > 5 && __cplusplus >= 201103L

namespace std {
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool signbit(float x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool signbit(double x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool signbit(long double x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isfinite(float x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isfinite(double x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isfinite(long double x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isnan(float x);
/* GCC 6.1 uses ::isnan(double x) for isnan(double x) */
DEVICE_FUNCTIONS_DECL cudart_builtin int cuisnan(double x) throw();
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isnan(long double x);
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isinf(float x);
/* GCC 6.1 uses ::isinf(double x) for isinf(double x) */
DEVICE_FUNCTIONS_DECL cudart_builtin int cuisinf(double x) throw();
DEVICE_FUNCTIONS_DECL cudart_builtin constexpr bool isinf(long double x);
}

else /* !(GNUC > 5 && __cplusplus >= 201103L) */

Modify move.h

How if you run nvcc, you will be presented with 4 errors, all containing /usr/include/c++/7/bits/move.h(48): error: identifier “__builtin_addressof” is undefined.
If we go to line 48 of /usr/include/c++/7/bits/move.h, we see that it is in a function that attempts to define __addressof.
// Used, in C++03 mode too, by allocators, etc.
/**
* @brief Same as C++11 std::addressof
* @ingroup utilities
*/
template
inline _GLIBCXX_CONSTEXPR _Tp*
__addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
{ return __builtin_addressof(__r); }
Unfortunately, we can not simply surround this with a check for CUDA and remove it if we are using CUDA, other parts of C++ need it. However, it is possible to add an additional (probably less optimized) piece of code, such as the one from this stackoverflow post.
Lines 36-60 of /usr/include/c++/7/bits/move.h should now be
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION

// Used, in C++03 mode too, by allocators, etc.
/**
* @brief Same as C++11 std::addressof
* @ingroup utilities
*/

ifndef CUDACC

template
inline _GLIBCXX_CONSTEXPR _Tp*
__addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
{ return __builtin_addressof(__r); }

else

template
inline _Tp*
__addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
{
return reinterpret_cast<_Tp*>
(&const_cast(reinterpret_cast(__r)));
}

endif

_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

Modify STL

Several header files in the C++ STL also need to be modified, just surround lines with an error with #ifndef CUDACC and #endif
Conclusion

It is possible to make CUDA 8.0 work with GCC 7.1.1, but some features of CUDA are lost. This may not be too much of a problem for you; it seems to be working for me.

[ubuntu]GCC与CUDNN版本不兼容 前言:距离上次的更新都过了4个月了…是在了太懒了…假期即将过去,尽量在回去之前做点啥… 由于毕设要做的方向涉及到原作者的代码文件是在linux系统上做的,在win10捣鼓了几天后,只好抄起我一年前的老本行ubuntu>.> 首先当然是查看我的cuda 和cudnn。 使用这篇博客的方法验证CUDA成功后,发现无法验证CUDNN。 报错: error: #error -- unsuppo... 阅读详情

相关推荐

ubuntu 16.04 编译opencv3.1,opencv多版本切换

第一步:更新驱动ubuntu 16.04的更新管理器集成了驱动更新,选择安装nivdia的驱动第二步:安装cudasudo apt-get install nvidia-cuda-toolkitcuda是7.5.18版,安装完后重启,在终端输入nivdia-smi,有结果则驱动和cuda安装成功。 但是cuda只支持部支持gcc5.0以上,及时后续用cmake编译opencv成功,gpu还是无法调用

Swearos的专栏 1万+

ns-3环境搭建

ns-3 是一款由 C++ 语言编写的开源网络仿真软件,主要运行平台是Linux。在ns-3中,网络拓扑中的节点、链路、协议栈的各个层次等被抽象成为各种C++类。

jiuzhao23的博客 1655

ns3 环境搭建

ns3 first.cc 安装

weixin_45301057的博客 2194

error -- unsupported GNU version! gcc versions later than 5 are not supported!

报错如下: 这个问题是gcc版本与cuda不兼容的问题,可以通过以下方式解决,我这里用的是cuda-8.0 先安装gcc-5,g++-5 sudo apt install gcc-5 g++-5 然后删除之前的软链接,建立新的 sudo rm /usr/local/cuda-8.0/bin/gcc sudo rm /usr/local/cuda-8.0/bin/g++ sudo ln -s /usr/bin/gcc-5 /usr/local/cuda-8.0/bin/gcc sudo

qq_30653631的博客 1786

嵌入式开发也玩“全家桶”?手把手教你用CLion+PyOCD调试APM32,比OpenOCD更简单

本文详细介绍了如何使用CLion和PyOCD组合进行APM32嵌入式开发,提供从环境配置到实战调试的完整指南。相比传统工具如Keil和OpenOCD,这套方案更轻量、易用,特别适合现代开发者需求,涵盖CMake配置、PyOCD调试技巧及常见问题解决。

weixin_42543046的博客 464

uCOS中的消息邮箱(:task与task之间传递一个数据(数据缓冲区))

程序需求,需要完成task与task之间  字符数组的数据传输 比如:在ucos中,串口2接收的字符数组是不定时的&不定长的;只有当接收到数据的时候_才将数据赋值给新数组 具体的程序示意如下: 图1:消息邮箱测试中的     向消息邮箱发送消息(OSMboxPost(Str_Box,(void*)rec);//发送消息--(向 消息邮箱_msg_key发送消息) ),实际项目需求的

faguoduifangui的博客 4540

cuda error gcc(unsupported GNU version! gcc versions later than 5 are not supported)

/usr/local/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported! #error -- unsupported GNU version! gcc versions later than 5 are not supported! 错误的解决方式很简单,就是安装低版本gcc和g++,并创建链接或更改gcc各版本的

m0_37400316的博客 1944

Python OpenCV基于颜色通道分离法去除图片中的红色印章

最近一段时间的工作都是研究如何去除图片中的红色印章,在网上查找了大量的大佬写过的方法,发现大多数是采取颜色通道分离法来做,并且效果还不错。站在前人的肩膀上,我又做了些许调整,谈不上是改进,但是能应对更对的情况总还是好的,特此记录。 拿发票做例子,印章相较于其它部分最大的不同就是印章是红色的,而其它部分不是(这是一句废话)。 那么第一步当然就是将红色分离出来,这一步可以采用Python第三方库OpenCV里的 cv2.split()方法,该方法是把RGB图像的三个通道拆分开来,得...

wl_Honest的博客 1万+

unsupported GNU version! gcc versions later than 6 are not supported!

welcome to my blog 问题#error -- unsupported GNU version! gcc versions later than 6 are not supported!,CUDA9.1不支持高版本的gcc 解决方法一: 安装低版本的gcc, 然后使用update-alternatives命令可以自由地切换不同版本的gcc 如下图的两句命令, 安装了低版本的gcc和g...

littlehaes的博客 1万+

关于动态存储器dram中rank,bank,device之间的关系

DEVICE_WIDTH表示设备的带宽(单位bit),每个列(column)包含DEVICE_WIDTH 位(bit),每一行(row)包含NUM_COLS个column。   而每一个bank包含NUM_ROWS个行(row)。所以一个设备(device)的存储容量为PER_DEVICE_STORAGE =NUM_ROWS*NUM_COLS*DEVICE_WIDTH*NUM_BANKS (i

wyj7260的专栏 4732

51单片机-点亮LED和蜂鸣器

ULN2003是高耐压、大电流达林顿陈列,由七个硅NPN达林顿管组成。ULN2003是大电流驱动陈列,多用于单片机、只能仪表、PLC、数字量输出卡等控制电路中。可直接驱动蜂鸣器、继电器等负载。void delay(u16 i) // i等于1大约10uswhile(i--);//取反,高低电平不断变化,产生脉冲delay(10);// 周期200us。

三日沐水 1128

Ubuntu18.04——切换gcc版本 / 报错解决: error -- unsupported GNU version gcc later than 10 are not supported

报错截图 /usr/local/cuda/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 unsuppor

Irving.Gao的博客 7468

Vmware虚拟机克隆详解:固定ip + 修改uuid等内容

分两大步 设置固定ip 克隆后修改相关配置 本文引用的其他地方的图片。会附上链接 若侵权,删 一、设置静态ip 先进行虚拟网络的编辑 接下来的操作需要管理员权限。(给权限就完事了) 接下来设置网卡: 网络和共享中心→ 更改适配器设置→VMware Network Adapter VMnet8 -> 右键属性 修改TCP/Ipv4的配置,网上常见是这种,笔者是英文的...

Unknownfuture的博客 9070

Darknet_ros unsupported GNU version gcc versions later than 6 are not supported解决方案

unsupported GNU version! gcc versions later than 6 are not supported 解决方案(darknet_ros)

weixin_45147024的博客 642

VSCode玩转Arduino:手把手解决‘未定义Serial’和头文件找不到的坑

本文详细介绍了在VSCode中配置Arduino开发环境时遇到的‘未定义Serial’和头文件找不到问题的解决方案。通过修改c_cpp_properties.json文件、调整IntelliSense引擎设置以及添加正确的库路径,开发者可以高效解决这些常见错误,提升开发体验。文章还提供了针对不同开发板和平台的高级配置技巧,确保配置的长期有效性。

weixin_42620202的博客 359

ABAP CDS 和 HANA SQL 的关系

摘要: ABAP CDS与HANA SQL既有紧密联系又有本质区别。ABAP CDS作为语义数据建模框架,在SQL基础上扩展了业务语义层,通过注解(annotations)、关联关系(associations)等机制为数据附加业务含义,并支持权限控制、客户端处理等ABAP平台特性。虽然CDS实体最终会转换为HANA数据库对象执行,但它并非简单的SQL封装,而是构建了独立于数据库的语义模型。二者在数据库执行层深度融合,ABAP CDS通过代码下推技术将计算任务优化到HANA层完成。实际开发中应优先使用ABAP

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 861

Error -- unsupported GNU version! gcc versions later than 6 are not supported!error

编译opencv3.4.1,报错

lul~的博客 464

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Ubuntu15.10_64位安装Theano+cuda7.5详细笔记

经过了3天的摸索,尝试了网上的各种方法,重装了N遍ubuntu,今天终于装好了,记录下来,与自己或者有需要的朋友一起分享。  介绍一下我的环境:GTX425M,笔记本win7_64+ubuntu15.10_64双系统,cuda7.5。  首先声明,我是安装完ubuntu15.10后,没有sudo apt-get update,没有安装其他的软件,没有disable Nouveau,直接安装的cuda

 啸林  1万+

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

ubuntu16 vscode darknet提示gcc版本不支持later than 6的

原因:gcc版本太高了,自己装的是7.3.0 解决: sudo rm /usr/local/cuda/bin/gcc sudo rm /usr/local/cuda/bin/g++ sudo ln -s /usr/bin/gcc-5 /usr/local/cuda/bin/gcc sudo ln -s /usr/bin/g++-5 /usr/local/cuda/bin/g++ 切换成gcc-...

mygugu的博客 341

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

cuda 7.5 不支持 ubuntu 15.10 的 gcc 5 编译器问题

报错: #error – unsupported GNU version! gcc versions later than 4.9 are not supported!装一个 4.9 的sudo apt-get install gcc-4.9 g++-4.9 ls /usr/bin/gcc-4.9 sudo ln -s /usr/bin/gcc-4.9 /usr/local/cuda/bin/gcc

yuzx2008的博客 1600

ubuntu19.10安装CUDA-10.1与cuDNN

ubuntu19.10安装cuda-10.1 1.安装N卡驱动: 打开ubuntu的软件和更新,设置N卡驱动 2.查看ubuntu显卡驱动 nvidia-smi 显示: Sun Feb 23 06:41:41 2020 +-----------------------------------------------------------------------------+ |...

沧夜的成长日记 2776

UBUNTU 15.10 CAFFE安装教程(测试可用)

ubuntu 15.10 caffe 安装

Tony的博客 2634

Deep Grasp部署调试

X86结构移植 系统环境 OS:Ubuntu20.04 ROS:noetic apt安装 PCL部分 因为gpd用到了pcl_gpu,因此需要针对pcl进行源码定制编译,这里记录遇到的问题和解决方案。使用cmake-gui配置pcl的cmakelists,如图,打开WITH部分,选中WITH GPU和WITH CUDA。 编译是遇到了问题,说compute_30不支持了,这个时候如下图,在CUDA里面把CUDA_ARCH_BIN中的不支持的版本去掉即可。 由于我电脑安装了cuda1

weixin_41003113的博客 1976

opencv安装-ubuntu18.04

opencv安装 opencv安装报错: In file included from /usr/include/host_config.h:50:0, from /usr/include/cuda_runtime.h:78, from <command-line>:0: /usr/include/c...

weixin_30544657的博客 345

ubuntu编译opencv3和opencv2共存

因为usr/local/opencv3/share/OpenCV/OpenCVConfig.cmake中设置了opencv的配置,自定义路径安装opencv时,找不到这个文件OpenCVConfig.cmake,opencv-config.cmake。通过nvidia-cuda-toolkit安装的,host_config.h在 /usr/include/下,如果通过cuda的run文件安装,也会因为gcc版本检查提示错误,也要修改对应位置的host_config.h。可以不同版本的opencv同时编译;

apple_51426592的博客 214

linux多版本opencv,Ubuntu 16.04 编译安装OpenCV 3.1及OpenCV多版本切换

在Ubuntu 16.04下编译安装OpenCV 3.1及OpenCV多版本切换的过程。第一步:更新驱动Ubuntu 16.04的更新管理器集成了驱动更新,选择安装nivdia的驱动第二步:安装cudasudo apt-get install nvidia-cuda-toolkitcuda是7.5.18版,安装完后重启,在终端输入nivdia-smi,有结果则驱动和cuda安装成功。但是cuda只...

weixin_42511315的博客 280
上一篇: Deformable Convolutional Network的原理与实现
下一篇: BEGAN: Boundary Equilibrium Generative Adversarial Networks的理解
田神
博客等级 码龄17年 217粉丝 33原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值