Darknet: Error on make: 'cuda_runtime.h: No such file or directory'

Created on 24 Mar 2018  ·  16Comments  ·  Source: pjreddie/darknet

Getting this error despite having CUDA 8 installed w/ CUDNN and OpenCV 3.2.0:

gcc -Iinclude/ -Isrc/ -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -c ./src/gemm.c -o obj/gemm.o
In file included from ./src/utils.h:5:0,
from ./src/gemm.c:2:
include/darknet.h:14:30: fatal error: cuda_runtime.h: No such file or directory
compilation terminated.
Makefile:87: recipe for target 'obj/gemm.o' failed
make: * [obj/gemm.o] Error 1

Where is that file supposed to be? Thanks!

Most helpful comment

For arch linux, use

sudo ln -s /opt/cuda/ /usr/local/cuda

All 16 comments

FIXED: Didn't have a symlink from /usr/local/cuda-8.0 to /usr/local/cuda, works fine now.

I try "sudo ln -s /usr/local/cuda-8.0 /usr/local/cuda ",and it works.Thanks to @brandonjabr

I am getting the same error and I have tried "sudo ln -s /usr/local/cuda-8.0 /usr/local/cuda " in the directory it does not work. How do I symlink? Thanks!

For arch linux, use

sudo ln -s /opt/cuda/ /usr/local/cuda

I get the same error but in Windows 10. How can get rid of it?

I get the same error but in Windows 10. How can get rid of it?

I already installed CUDA 10.1 on my windows 10 and got the same error (Error on make: 'cuda_runtime.h: No such file or directory'). I do not know what should be a symlink and how does the symlink. It would be highly appreciated to advise me.

When you run ln -s /usr/local/cuda-8.0 /usr/local/cuda can you explain what should be exactly these folders ? In my case I have nothing similar to both of them.

My CUDA_PATH is C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
and when I run which nvcc I get /cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc

Someone could advise me please ? :)

In case someone needs, you can also fix this using CPATH, LD_LIBRARY_PATH, and PATH:

export CPATH=/usr/local/cuda-10.1/targets/x86_64-linux/include:$CPATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/targets/x86_64-linux/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.1/bin:$PATH

When you run ln -s /usr/local/cuda-8.0 /usr/local/cuda can you explain what should be exactly these folders ? In my case I have nothing similar to both of them.

My CUDA_PATH is C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
and when I run which nvcc I get /cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc

Someone could advise me please ? :)

Have you solved the problem?

no :/ I just stopped to use cygwin and restored my computer it was a mess in my paths

Thank you for your reply, I tried to use absolute paths to help find cuda.h files, but there were too many changes to make. Finally, I use VS to make file

发送自 Windows 10 版邮件应用

发件人: ArnaudDev
发送时间: 2019年11月29日 16:10
收件人: pjreddie/darknet
抄送: skybocai; Comment
主题: Re: [pjreddie/darknet] Error on make: 'cuda_runtime.h: No such fileor directory' (#553)

no :/ I just stopped to use cygwin and restored my computer it was a mess in my paths

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

I'm on Windows and had a lot of trouble figuring this out. I edited these lines in my Makefile.in to point explicitly to my CUDA path:

COMMON+= -DGPU -I/C:/Users///include/
LDFLAGS+= -L/C:/Users/Cylon///include/lib/x64 -lcuda -lcudart -lcublas -lcurand

I'm using OpenCV 4.2.0 and CUDA 10.2

If people are still running into this issue, this fixed it for me.

COMMON+= -DGPU -I 'C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/include'
LDFLAGS+= -L 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64' -lcuda -lcudart -lcublas -lcurand

So pretty much what @ljsauer said, but removing the "/" between -I (which is the "search" command, saw someone asking what it was) and the path. Just to save someone from searching for a solution forever :)

If people are still running into this issue, this fixed it for me.

COMMON+= -DGPU -I 'C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/include'
LDFLAGS+= -L 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64' -lcuda -lcudart -lcublas -lcurand

So pretty much what @ljsauer said, but removing the "/" between -I (which is the "search" command, saw someone asking what it was) and the path. Just to save someone from searching for a solution forever :)

I am so stumped as these paths are correct for me but it doesn't work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

job2003 picture job2003  ·  3Comments

HoracceFeng picture HoracceFeng  ·  3Comments

ryuzakinho picture ryuzakinho  ·  4Comments

cadip92 picture cadip92  ·  3Comments

TheHidden1 picture TheHidden1  ·  3Comments