Missing libnvbufsurface.so at /opt/nvidia/deepstream/deepstream/lib/libnvbufsurface.so in Docker on Jetson

Complete information regarding my setup:

  • Hardware Platform: Jetson Orin NX 16 GB
  • DeepStream Version: 7.0
  • JetPack Version: 6.0
  • TensorRT Version: 8.6.2.3
  • Issue Type: Question / Bug

Hello,

I need to create a Docker image with DeepStream by compiling and building the Python bindings in order to address another bug reported here. However, I am encountering issues with the cmake command options:

# 2. Compiling the bindings
# 2.2 Quick build 2 (Jetson-ubuntu-22.04 | python 3.10 | Deepstream 7.0)
RUN cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings && \
    mkdir build && cd build && \
    cmake .. -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=10 \
             -DPIP_PLATFORM=linux_aarch64 \
             -DDS_PATH=/opt/nvidia/deepstream/deepstream && \
    make -j$(nproc)

The output I get is:

CMake Error at CMakeLists.txt:92 (message):
  Missing libnvbufsurface.so at
  /opt/nvidia/deepstream/deepstream/lib/libnvbufsurface.so
  please make sure that DeepStream is installed

But, actually, inside the container the file exists:

root@orin-desktop:/opt# ls /opt/nvidia/deepstream/deepstream/lib/libnvbufsurface.so
/opt/nvidia/deepstream/deepstream/lib/libnvbufsurface.so

Here is my Dockerfile:

# Use NVIDIA DeepStream 7.0 base image with multi-architecture support
FROM nvcr.io/nvidia/deepstream:7.0-samples-multiarch

# Set non-interactive mode to avoid prompts during package installs and configure timezone
ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Rome

# Update package lists, upgrade system packages, and install dependencies
# Required for building and running DeepStream Python bindings on ARM64
RUN apt update && \
    apt upgrade -y && \
    apt install -y vim && \
    apt install -y python3-opencv && \
    apt install -y ffmpeg && \
    apt install -y graphviz

# Compile and Build DeepStream python bindings
# - commands-source: https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/tree/v1.1.11/bindings
# - reason: https://forums.developer.nvidia.com/t/issue-with-parallel-branches-in-deepstream-pipeline/343499/11?u=vic01

# 1. Prerequisites
# 1.2 Base dependencies: dependencies need to be met in order to compile bindings 
RUN apt install -y python3-gi python3-dev python3-gst-1.0 \
    python-gi-dev git meson python3 python3-pip python3.10-dev \
    cmake g++ build-essential libglib2.0-dev libglib2.0-dev-bin \
    libgstreamer1.0-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev \
    libgstrtspserver-1.0-dev gstreamer1.0-rtsp

# 1.3 Initialization of submodules (DeepStream SDK 7.0)
RUN git clone -b v1.1.11 https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git \
        /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps && \
    cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/ && \
    git submodule update --init

# 1.4 Installing Gst-python: Build and install gst-python
RUN apt-get install -y apt-transport-https ca-certificates -y && \ 
    update-ca-certificates && \
    cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/3rdparty/gstreamer/subprojects/gst-python/ && \
    meson setup build  && \
    cd build  && \
    ninja  && \
    ninja install 

# Fix the file bindnvdsinfer.cpp (to support unique_id in segmeta) file as in:
# https://forums.developer.nvidia.com/t/issue-with-parallel-branches-in-deepstream-pipeline/343499/11?u=vic01
RUN sed -i '256a .def_readonly("unique_id", &NvDsInferSegmentationMeta::unique_id)' \
    /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/src/bindnvdsinfer.cpp

# 2. Compiling the bindings
# 2.2 Quick build 2 (Jetson-ubuntu-22.04 | python 3.10 | Deepstream 7.0)
RUN cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings && \
    mkdir build && cd build && \
    cmake .. -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=10 \
             -DPIP_PLATFORM=linux_aarch64 \
             -DDS_PATH=/opt/nvidia/deepstream/deepstream && \
    make -j$(nproc)

# 3. Installing the bindings
RUN cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/build && \
    python3 -m pip install --upgrade pip && \
    pip3 install ./pyds-1.1.11-py3-none*.whl

# Install additional packages that might be necessary to use all of the DeepStreamSDK features
RUN pip3 install cuda-python==12.8.0 && \
    /opt/nvidia/deepstream/deepstream/user_additional_install.sh

I have seen a similar problem reported here, and the suggested solution was to use prebuilt bindings. Unfortunately, I cannot do that because I need to recompile the bindings.

How can I resolve this issue?

Thank you in advance for your support!

Some shared libraries are dynamically loaded into the container at runtime. They are shared between the host and the container, including libnvbufsurface.so. They are not visible in the docker image during the build phase.

If you want to recompile pyds, please start a container to compile, and then use the COPY instruction in the Dockerfile to rebuild your Docker image

Please use nvcr.io/nvidia/deepstream-l4t:7.0-triton-multiarch , xx-sample only contains runtime libraries, you may encounter problems with missing header files

For ds-7.0 it should be cuda-python==12.2

Thank you for the clarifications!

Regarding the base image: for a production release, should I still use nvcr.io/nvidia/deepstream-l4t:7.0-triton-multiarch, or is that image intended only for development? If it’s only for development, which image should I use for production?

nvcr.io/nvidia/deepstream-l4t:7.0-triton-multiarch is used for development and can also be used for deployment.It takes up more disk space.

nvcr.io/nvidia/deepstream-l4t:7.1-samples-multiarch is only used for deployment.