gcc找不到cuda_runtime.h,即使路径带有-I标志(cygwin)

时间:2017-12-06 13:48:05

标签: gcc cuda cygwin nvcc darknet

我正在尝试使用cygwin为windows编译darknet。我已经在Windows上安装了CUDA,我从{cygwin文件夹中created symlinks到Windows文件夹:

ln -sv /cygdrive/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v8.0/include/ /usr/local/cuda/include
ln -sv /cygdrive/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v8.0/lib/x64/ /usr/local/cuda/lib64

现在,ls /usr/local/cuda/include列出了CUDA包含文件夹中的文件(包括cuda_runtime.h)。

从darknet文件夹运行make后,会编译一些文件,直到达到convolutional_kernels.cu。然后gcc抛出:

<built-in>: note: this is the location of the previous definition
nvcc -ccbin gcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ --compiler-options "-Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
gcc: error: cuda_runtime.h: No such file or directory
gcc: error: unrecognized command line option ‘-nologo’
gcc: error: unrecognized command line option ‘-EHsc’
convolutional_kernels.cu
make: *** [Makefile:88: obj/convolutional_kernels.o] Error 1

尽管如此,在此之前只有几行:

<built-in>: note: this is the location of the previous definition
gcc -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU -c ./src/lstm_layer.c -o obj/lstm_layer.o
In file included from /usr/local/cuda/include/device_types.h:53:0,
             from /usr/local/cuda/include/builtin_types.h:56,
             from /usr/local/cuda/include/cuda_runtime.h:86,
             from include/darknet.h:14,
             from ./src/activations.h:3,
             from ./src/lstm_layer.h:4,
             from ./src/lstm_layer.c:1:
/usr/local/cuda/include/host_defines.h:84:0: warning: "__cdecl" redefined
#define __cdecl

清楚地表明CUDA包含(例如cuda_runtime.h)是可以访问的。

我修改makefile的唯一方法是,我要求nvcc明确使用gcc代替windows cl.exe。在第23行,我已将NVCC=nvcc更改为NVCC=nvcc -ccbin gcc

有没有人知道如何解决这个编译错误?

0 个答案:

没有答案