如何使用gcc 5构建CUDA 8样本? [英] How to build CUDA 8 samples with gcc 5?
问题描述
我已经在Ubuntu 17.04上安装了 cuda-samples-8-0
软件包,我想使用 gcc-构建示例。 5
,这是我在计算机上沿着 gcc-6
安装的。 CUDA 8不支持gcc-6`,并且会产生许多编译错误。
I have installed the cuda-samples-8-0
package on Ubuntu 17.04, and I will would like to build the samples with gcc-5
, which I have installed along gcc-6
on my machine. gcc-6` is not supported by CUDA 8 and gives numerous compilation errors.
如何获取 make
的用法 gcc-5
?
我已经尝试过 sudo make CXX = g ++-5 CC =
仍会导致 /usr/local/cuda-8.0/samples
目录中的gcc-5 gcc-6
正在使用。
I have tried sudo make CXX=g++-5 CC=gcc-5
from the /usr/local/cuda-8.0/samples
directory which still leads to gcc-6
being used.
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
推荐答案
我通过将 / usr / bin / gcc-5
链接到 /usr/local/cuda-8.0/bin/gcc来使它工作
和 / usr / bin / g ++-5
到 /usr/local/cuda-8.0/bin/g ++
:
sudo ln -s /usr/bin/gcc-5 /usr/local/cuda-8.0/bin/gcc
sudo ln -s /usr/bin/g++-5 /usr/local/cuda-8.0/bin/g++
而且在收到错误<$ c之后,我还必须遵循此答案 $ c> / usr / bin / ld:找不到-lnvcuvid
And I also had to follow this answer after getting the error /usr/bin/ld: cannot find -lnvcuvid
这篇关于如何使用gcc 5构建CUDA 8样本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!