Ros2_jetson repo: Unable to run ROS2 example app inside container built from repo Dockerfile

OK, did apt install libnvinfer-dev, which looked to run through fine.

However, now when I run CUDA_VER=11.4 make -C nvdsinfer_custom_impl_Yolo I get this error:

root@ubuntu:/opt/DeepStream-Yolo# CUDA_VER=11.4 make -C nvdsinfer_custom_impl_Yolo
make: Entering directory ‘/opt/DeepStream-Yolo/nvdsinfer_custom_impl_Yolo’
g++ -c -o utils.o -Wall -std=c++11 -shared -fPIC -Wno-error=deprecated-declarations -I/opt/nvidia/deepstream/deepstream/sources/includes -I/usr/local/cuda-11.4/include utils.cpp
In file included from /usr/include/aarch64-linux-gnu/NvInferLegacyDims.h:16,
from /usr/include/aarch64-linux-gnu/NvInfer.h:16,
from utils.h:36,
from utils.cpp:26:
/usr/include/aarch64-linux-gnu/NvInferRuntimeCommon.h:19:10: fatal error: cuda_runtime_api.h: No such file or directory
19 | include <cuda_runtime_api.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:70: utils.o] Error 1
make: Leaving directory ‘/opt/DeepStream-Yolo/nvdsinfer_custom_impl_Yolo’

I found your thread here, which mentions this issue:

But when I search for “cuda_runtime_api.h” it’s not present in the container:

root@ubuntu:/usr/local# ls -la
total 48
drwxr-xr-x 1 root root 4096 Jul 22 18:27 .
drwxr-xr-x 1 root root 4096 Jul 20 11:03 …
drwxr-xr-x 1 root root 4096 Jul 22 20:10 bin
lrwxrwxrwx 1 root root 22 Jul 22 18:27 cuda → /etc/alternatives/cuda
lrwxrwxrwx 1 root root 25 Jul 22 18:27 cuda-11 → /etc/alternatives/cuda-11
drwxr-xr-x 1 root root 4096 Jul 22 18:30 cuda-11.4
drwxr-xr-x 2 root root 4096 May 31 15:55 etc
drwxr-xr-x 2 root root 4096 May 31 15:55 games
drwxr-xr-x 1 root root 4096 Aug 23 01:54 include
drwxr-xr-x 1 root root 4096 Aug 23 01:54 lib
lrwxrwxrwx 1 root root 9 May 31 15:55 man → share/man
drwxr-xr-x 2 root root 4096 May 31 16:12 sbin
drwxr-xr-x 1 root root 4096 Oct 3 16:13 share
drwxr-xr-x 2 root root 4096 May 31 15:55 src
(reverse-i-search)`': ^C
root@ubuntu:/usr/local# find . -name cuda_runtime_api.h
root@ubuntu:/usr/local#

So I tried adding the command from further up in the current thread, which installs the full CUDA Toolkit:

RUN apt-get update &&
apt-get install -y --no-install-recommends
cuda-toolkit-11-4
&& rm -rf /var/lib/apt/lists/*
&& apt-get clean

This runs through fine, but now the CUDA_VER=11.4 make -C nvdsinfer_custom_impl_Yolo command causes this error:

Step 42/47 : RUN cd DeepStream-Yolo && CUDA_VER=11.4 make -C nvdsinfer_custom_impl_Yolo
—> Running in c27e1c013039
make: Entering directory ‘/opt/DeepStream-Yolo/nvdsinfer_custom_impl_Yolo’
g++ -c -o utils.o -Wall -std=c++11 -shared -fPIC -Wno-error=deprecated-declarations -I/opt/nvidia/deepstream/deepstream/sources/includes -I/usr/local/cuda-11.4/include utils.cpp
g++ -c -o nvdsinfer_yolo_engine.o -Wall -std=c++11 -shared -fPIC -Wno-error=deprecated-declarations -I/opt/nvidia/deepstream/deepstream/sources/includes -I/usr/local/cuda-11.4/include nvdsinfer_yolo_engine.cpp
In file included from nvdsinfer_yolo_engine.cpp:26:
/opt/nvidia/deepstream/deepstream/sources/includes/nvdsinfer_custom_impl.h:126:10: fatal error: NvCaffeParser.h: No such file or directory
126 | include “NvCaffeParser.h”
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:70: nvdsinfer_yolo_engine.o] Error 1
make: Leaving directory ‘/opt/DeepStream-Yolo/nvdsinfer_custom_impl_Yolo’
The command ‘/bin/sh -c cd DeepStream-Yolo && CUDA_VER=11.4 make -C nvdsinfer_custom_impl_Yolo’ returned a non-zero code: 2

Attempting to use nvcr.io/nvidia/deepstream-l4t:6.1.1-triton as the base image to solve these issues…