【发布时间】:2017-12-21 23:24:25
【问题描述】:
我正在尝试在我的 Debian GNU/Linux 系统上使用 CUDA 工具包进行编译,但即使在极其简单的程序中,C++11 支持显然也被破坏了。
首先,这里是相关软件版本的列表:
- Linux 内核:4.13.0
- CUDA 工具包:8.0.61
- Clang:3.8.1
- libc:2.25
- libstdc++: 7.2.0
使用一个非常基本的测试文件test.cu,如下:
__global__ void testfunc(float *a, float *b, int N)
{
for (int i = 0; i < N; ++i) {
b[i] += a[i];
}
}
并使用命令编译:
nvcc -ccbin clang-3.8 -std c++11 -o test test.cu
我得到一长串declaration conflicts with target of using declaration already in scope 错误。我将在下面显示两个 - 它会在 20 点自动切断。
/usr/include/math_functions.h:8925:41: error: declaration conflicts with target of using declaration already in scope
__attribute((always_inline)) inline int signbit(float x);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/cmath:668:16: note: target of using declaration
constexpr bool signbit(float __x)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/math.h:68:12: note: using declaration
using std::signbit;
^
/usr/include/math_functions.h:8929:41: error: declaration conflicts with target of using declaration already in scope
__attribute((always_inline)) inline int signbit(double x);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/cmath:672:16: note: target of using declaration
constexpr bool signbit(double __x)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/math.h:68:12: note: using declaration
using std::signbit;
^
我是否使用了与 CUDA 不兼容的编译器/库版本?似乎很难找到这些信息,尤其是在 Nvidia 没有正式支持 Debian 的情况下。我只使用由 Debian 存储库分发的软件包(我在测试分发中)。
【问题讨论】:
-
也许您应该在受支持的发行版上试用它。由于您尝试使用 clang,这看起来不正确:
..lib/gcc/..请参阅 here -
感谢@RobertCrovella,如果我安装 libc++ 并使用
--compiler-options -stdlib=libc++而不是让 clang 使用 gcc 库(对于 CUDA 8.0 来说太新而无法支持),它似乎工作正常。我会写一个答案。
标签: linux c++11 cuda debian clang