0

I'm trying to compile darknet for windows using cygwin. I already have CUDA installed on windows, and I've created symlinks from cygwin folders to windows folders:

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

Now, ls /usr/local/cuda/include lists files in the CUDA include folder (including cuda_runtime.h).

After running make from darknet folder, some files are compiled until convolutional_kernels.cu is reached. Then gcc throws:

<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

even though, just couple of lines before there is this:

<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

which clearly shows that CUDA includes (e.g. cuda_runtime.h) are reachable.

The only way I've modified makefile is that I asked of nvcc to explicitly use gcc instead of windows' cl.exe. At line 23 I've changed NVCC=nvcc to NVCC=nvcc -ccbin gcc

Does anyone have an idea how to solve this compilation error?

zkristic
  • 629
  • 1
  • 9
  • 24
  • 2
    `gcc` isn't an officially supported host compiler for use by `nvcc` on a windows platform – Robert Crovella Dec 06 '17 at 15:29
  • @RobertCrovella So `-ccbin` parameter is of no use on Windows, or of no use only for gcc on Windows? – zkristic Dec 06 '17 at 15:37
  • 1
    the `-ccbin` parameter on windows is typically used during compilation from a Visual Studio session. If you had multiple `cl.exe` versions installed on windows, you could use the `-ccbin` parameter to select a particular one. This wouldn't really be sensible or necessary from within VS, since VS build environment should handle that for you, but if you were using some other build system e.g. CMake on windows (along with a proper VS toolchain for host compiler support for CUDA) the `-ccbin` parameter might be useful. Not sure why it matters whether the `-ccbin` parameter is of use on Windows – Robert Crovella Dec 06 '17 at 15:54
  • @RobertCrovella Doesn't matter in my case... I was just wondering why was it there if not useful. I didn't consider a case when one has multiple versions of `cl.exe` installed. Now I know :) Do you know if there are plans for `nvcc` to support `gcc`? I'm guessing I'm not the only one who came across this issue... – zkristic Dec 06 '17 at 16:03
  • 1
    I'm not generally able to discuss future plans here. Sorry. – Robert Crovella Dec 06 '17 at 16:09
  • Not being in the know, it seems less of a stretch to support mingw 64 bit than cygwin native gcc. – tim18 Dec 06 '17 at 16:39
  • @tim18 looking at some threads on NVIDIA's devtalk forum, people have been asking for this since 2007. I don't have high expectations for either of those two options. Might be best to dual boot Linux alongside Windows. – zkristic Dec 06 '17 at 16:48

0 Answers0