retinanet-examples
retinanet-examples copied to clipboard
Cannot build C++ API in dockerfile using JetPack 4.6
Using the following dockerfile on an Xavier AGX (also have tried on a TX2):
FROM nvcr.io/nvidia/l4t-tensorrt:r8.0.1-runtime
ENV DEBIAN_FRONTEND=noninteractive
# Install apt packages
COPY nvidia-l4t-apt-source.list /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
COPY jetson-ota-public.asc /etc/apt/trusted.gpg.d/jetson-ota-public.asc
RUN apt-get update && apt-get install -y --no-install-recommends \
vim git ffmpeg pkg-config build-essential cmake \
libopencv-dev liblcm-dev glib2.0-dev && apt-get clean && rm -fr /var/lib/apt/lists/*
# Install ODTK C++ inference API
WORKDIR /
RUN git clone -b main --depth 1 https://github.com/NVIDIA/retinanet-examples.git odtk
WORKDIR odtk
RUN git checkout 65e63109bf5d12c9ad11b6f5bcdec12a117ee888
WORKDIR /odtk/extras/cppapi
RUN mkdir build
WORKDIR build
RUN ln -s /usr/local/cuda/include/thrust/system/cuda/detail/cub /usr/local/cuda/include/cub
RUN cmake -DCMAKE_CUDA_FLAGS="--expt-extended-lambda -std=c++14" ..
RUN make
I get the following error:
---> Running in 230ef2ef8bee
Scanning dependencies of target odtk
[ 7%] Building CUDA object CMakeFiles/odtk.dir/odtk/csrc/cuda/decode.cu.o
/odtk/csrc/cuda/decode.cu(63): error: name followed by "::" must be a class or namespace name
/odtk/csrc/cuda/decode.cu(64): error: name followed by "::" must be a class or namespace name
/odtk/csrc/cuda/decode.cu(64): error: expected an identifier
/odtk/csrc/cuda/decode.cu(64): error: expected a ")"
/odtk/csrc/cuda/decode.cu(67): error: name followed by "::" must be a class or namespace name
/odtk/csrc/cuda/decode.cu(100): error: name followed by "::" must be a class or namespace name
/odtk/csrc/cuda/decode.cu(101): error: name followed by "::" must be a class or namespace name
/odtk/csrc/cuda/decode.cu(101): error: expected an identifier
/odtk/csrc/cuda/decode.cu(101): error: expected a ")"
/odtk/csrc/cuda/decode.cu(111): error: name followed by "::" must be a class or namespace name
10 errors detected in the compilation of "/tmp/tmpxft_00000011_00000000-6_decode.cpp1.ii".
make[2]: *** [CMakeFiles/odtk.dir/odtk/csrc/cuda/decode.cu.o] Error 1
CMakeFiles/odtk.dir/build.make:62: recipe for target 'CMakeFiles/odtk.dir/odtk/csrc/cuda/decode.cu.o' failed
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/odtk.dir/all' failed
make[1]: *** [CMakeFiles/odtk.dir/all] Error 2
make: *** [all] Error 2
Makefile:83: recipe for target 'all' failed
The command '/bin/sh -c make' returned a non-zero code: 2
Makefile:10: recipe for target 'arm' failed
make: *** [arm] Error 2
I have tried playing with the include order for the *.cuh
files, including additional headers that seem to contain missing symbols (such as device_select.cuh
) and keep running into this. I ran into this exact error on TX2 as well when I tried to build the full python module through setup.py. Note that the ln -s
step is needed else the cub
headers will not be found.
I was able to get this working by reflashing to JetPack 4.5.1
and using branch 20.03
, as well as changing the base image:
FROM nvcr.io/nvidia/l4t-ml:r32.5.0-py3
ENV DEBIAN_FRONTEND=noninteractive
# Install apt packages
COPY nvidia-l4t-apt-source.list /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
COPY jetson-ota-public.asc /etc/apt/trusted.gpg.d/jetson-ota-public.asc
RUN apt-get update && apt-get install -y --no-install-recommends \
vim git ffmpeg pkg-config build-essential cmake \
libopencv-dev && apt-get clean && rm -fr /var/lib/apt/lists/*
# Install ODTK C++ inference API
WORKDIR /
RUN git clone -b 20.03 --depth 1 https://github.com/NVIDIA/retinanet-examples.git odtk
WORKDIR /odtk/extras/cppapi
RUN mkdir build
WORKDIR build
RUN cmake -DCMAKE_CUDA_FLAGS="--expt-extended-lambda -std=c++14" ..
RUN make