Fatal error: cuda_runtime_api.h not found

Hi, I’m trying to compile the following trivial code (using g++ file_name.cpp):
[Context - I’m trying to create an inference script that uses a tensor-rt engine file on a Jetson Xavier]

#include <NvInfer.h>

int main(int argc, char *argv[]) {
    return 0;

But I get the following error.

/usr/include/aarch64-linux-gnu/NvInferRuntimeCommon.h:56:10: fatal error: cuda_runtime_api.h: No such file or directory
#include <cuda_runtime_api.h>

I’ve tried updating Path variables, and this is what’s in my ~/.bashrc file.

export CUDA=10.2
export PATH=/usr/local/cuda-$CUDA/bin:$PATH
export CUDA_PATH=/usr/local/cuda-$CUDA
export CUDA_HOME=/usr/local/cuda-$CUDA
export LD_LIBRARY_PATH=/usr/local/cuda-$CUDA/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH

It hasn’t fixed my issue. Could someone please help me resolve this?


Do you compile your application with Makefile?
If yes, please add the INC path like below:

$ nvcc my.cu -I/usr/local/cuda-11.4/targets/aarch64-linux/include/ ..


1 Like

Hmm, doing nvcc my_filename.cpp does compile my file, thank you. But I do want to know where cuda_runtime_api.h is located on my filesystem. Running the find command did not yield any results. Do you know the location?

Did you install the package cuda-cudart-dev-10-2 ? If so, you should have /usr/local/cuda-10.2/targets/aarch64-linux/include/cuda_runtime_api.h

1 Like


The file is under /usr/local/cuda-11.4/targets/aarch64-linux/include/.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.