We’re trying to use build machines to build Docker images for Jetsons and it seems very inconvenient to do off of a Jetson.
As explained in this post
adding –runtime nvidia to a docker run command on a Jetson causes NVIDIA’s container runtime to bind-mount a ton of libraries to
/usr/lib/aarch64-linux-gnu/nvidia/
Without this bind-mount, you can’t link against nvinfer because it will try linking against other libraries like these:
#10 0.637 /usr/bin/ld: warning: libnvos.so, needed by /usr/lib/aarch64-linux-gnu/nvidia/libnvdla_compiler.so, not found (try using -rpath or -rpath-link)
#10 0.637 /usr/bin/ld: warning: libnvcudla.so, needed by /usr/local/cuda/targets/aarch64-linux/lib/libcudla.so.1, not found (try using -rpath or -rpath-link)
and these libraries are only present on the Jetson.
Here’s a simple Dockerfile that reproduces the error.
tensorrt_main.cpp
#include <NvInfer.h>
#include <NvInferVersion.h>
struct Logger : public nvinfer1::ILogger {
void log(Severity severity, const char* msg) noexcept override {
}
};
int main() {
// smoke check: force the linker to resolve symbols in libnvinfer
Logger logger;
nvinfer1::IBuilder* builder = nvinfer1::createInferBuilder(logger);
}
Dockerfile
FROM nvcr.io/nvidia/l4t-tensorrt:r10.3.0-devel
RUN <<EOF
apt-get --quiet=2 update
apt-get --quiet=2 --yes --no-install-recommends install clang
EOF
SHELL ["/bin/bash","-c"]
WORKDIR /workspace
COPY tensorrt_main.cpp ./
ENV CXX=clang++
RUN $CXX -v \
-I/usr/local/cuda/targets/$(uname -m)-linux/include \
-c tensorrt_main.cpp \
-o tensorrt_main.o
RUN $CXX \
-v \
-L/usr/local/cuda/targets/$(uname -m)-linux/lib \
-L/usr/lib/$(uname -m)-linux-gnu/nvidia \
tensorrt_main.o \
-o tensorrt_main \
-Wl,--as-needed,-rpath-link,/usr/lib/aarch64-linux-gnu/nvidia \
-lnvinfer
To build, assuming tensorrt_main.cpp and Dockerfile are in your current directory
docker buildx build --platform linux/arm64 --tag jetson-test .
How is everyone else doing it?