nvcc include search path

I’m trying to compile NVIDIA_CUDA-10.1_Samples/1_Utilities/deviceQuery on a new machine but failed:

$ make
deviceQuery.cpp:16:10: fatal error: cuda_runtime.h: No such file or directory
 #include <cuda_runtime.h>

          ^~~~~~~~~~~~~~~~

Then I tried a dry run:

$ nvcc deviceQuery.cpp --dryrun
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/usr/local/cuda-10.1/bin
#$ _THERE_=/usr/local/cuda-10.1/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_DIR_=targets/x86_64-linux
#$ TOP=/usr/local/cuda-10.1/bin/..
#$ NVVMIR_LIBRARY_DIR=/usr/local/cuda-10.1/bin/../nvvm/libdevice
#$ LD_LIBRARY_PATH=/usr/local/cuda-10.1/bin/../lib:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/lib64:/usr/local/cuda-9.0/lib64:/usr/local/cuda/lib64
#$ PATH=/usr/local/cuda-10.1/bin/../nvvm/bin:/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/bin:/home/user/bin:/usr/local/bin:/usr/local/cuda/bin:/usr/local/cuda-10.1/bin:/usr/local/cuda-9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
#$ INCLUDES="-I/usr/local/cuda-10.1/bin/../targets/x86_64-linux/include"
#$ LIBRARIES=  "-L/usr/local/cuda-10.1/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda-10.1/bin/../targets/x86_64-linux/lib"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
#$ gcc -std=c++14 -c -x c++ -D__NVCC__  "-I/usr/local/cuda-10.1/bin/../targets/x86_64-linux/include"    -D__CUDACC_VER_MAJOR__=10 -D__CUDACC_VER_MINOR__=1 -D__CUDACC_VER_BUILD__=105 -m64 -o "/tmp/tmpxft_0000241a_00000000-4_deviceQuery.o" "deviceQuery.cpp"
#$ nvlink --arch=sm_30 --register-link-binaries="/tmp/tmpxft_0000241a_00000000-2_a_dlink.reg.c"  -m64   "-L/usr/local/cuda-10.1/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda-10.1/bin/../targets/x86_64-linux/lib" -cpu-arch=X86_64 "/tmp/tmpxft_0000241a_00000000-4_deviceQuery.o"  -o "/tmp/tmpxft_0000241a_00000000-5_a_dlink.sm_30.cubin"
#$ fatbinary --create="/tmp/tmpxft_0000241a_00000000-3_a_dlink.fatbin" -64 -link "--image=profile=sm_30,file=/tmp/tmpxft_0000241a_00000000-5_a_dlink.sm_30.cubin" --embedded-fatbin="/tmp/tmpxft_0000241a_00000000-3_a_dlink.fatbin.c"
#$ rm /tmp/tmpxft_0000241a_00000000-3_a_dlink.fatbin
#$ gcc -std=c++14 -c -x c++ -DFATBINFILE="\"/tmp/tmpxft_0000241a_00000000-3_a_dlink.fatbin.c\"" -DREGISTERLINKBINARYFILE="\"/tmp/tmpxft_0000241a_00000000-2_a_dlink.reg.c\"" -I. -D__NV_EXTRA_INITIALIZATION= -D__NV_EXTRA_FINALIZATION= -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__  "-I/usr/local/cuda-10.1/bin/../targets/x86_64-linux/include"    -D__CUDACC_VER_MAJOR__=10 -D__CUDACC_VER_MINOR__=1 -D__CUDACC_VER_BUILD__=105 -m64 -o "/tmp/tmpxft_0000241a_00000000-6_a_dlink.o" "/usr/local/cuda-10.1/bin/crt/link.stub"
#$ g++ -m64 -o "a.out" -std=c++14 -Wl,--start-group "/tmp/tmpxft_0000241a_00000000-6_a_dlink.o" "/tmp/tmpxft_0000241a_00000000-4_deviceQuery.o"   "-L/usr/local/cuda-10.1/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda-10.1/bin/../targets/x86_64-linux/lib" -lcudadevrt  -lcudart_static  -lrt -lpthread  -ldl  -Wl,--end-group

I did find cuda_runtime.h in the include folder:

$ ls /usr/local/cuda-10.1/bin/../targets/x86_64-linux/include | grep cuda_runtime.h
cuda_runtime.h

I also set PATH and LD_LIBRARY_PATH:

export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Don’t know what’s going on here. Is the default include search path determined when compiling CUDA? How can I tell the nvcc default include search path?

I met a similar issue, did you find solution now. if yes, could you please share it.Thank you in advance

Exactly the same problem here. Basically, nvcc is not finding files in the include folders. Posted a question about it with some detail… [NSight Eclipse Build errors - Include settings]
Nobody has replied yet.
The documentation is pretty lousy or nonexistent!

Possibly related problem…
under the project, under release, there’s src/sources.mk
it is as follows… doesn’t look very healthy to me. Any idea why this is all empty with no mention of any files or folders??

################################################################################

Automatically-generated file. Do not edit!

################################################################################

CU_SRCS :=
C_UPPER_SRCS :=
CXX_SRCS :=
C++_SRCS :=
OBJ_SRCS :=
CC_SRCS :=
ASM_SRCS :=
C_SRCS :=
CPP_SRCS :=
O_SRCS :=
S_UPPER_SRCS :=
EXECUTABLES :=
OBJS :=

Every subdirectory with source files must be described here

SUBDIRS :=
src \