Hey guys,
my goal is it to crosscompile an docker image on x86 with with opencv cuda support.
At first i have used this manual from the nvidia dockerhub: NVIDIA Container Runtime on Jetson · NVIDIA/nvidia-docker Wiki · GitHub
My Systems: Server with RTX 3090 and Ubuntu 20.04 LTS, Jetson Xavier NX with jetpack 4.5
So the first Point is, that i can build the Dockerfile on the Jetson with this manual and it prints me out my systems informations in the end.
In the next step i have build the dockerfile with the nvidia base image 32.5.0 with opencv cuda support on the jetson. It works too.
So now i like do do this things on my x86 workstation, but however it fails. I have done every single step from the nvidia manual for cross compiling. i have tryed at on ubuntu 18.04, 20.04 with the cuda 11.6 driver for my graphic card on the host system. I have also tryed to install cuda 10.2 on my host system, but this fails. Also i have installed the nvidia sdk manager to get the right dependencies for Jetpack 4.5.
I haved installed navidia runtimes and edit the deamon.jason on the host, to used runtime in the build prcocess like on the Xavier NX.
And i can build the docker container on the host, but only without cuda support for opencv or something other.
EVERY TIME i have copyed the smaples form my xavier into the docker container, like the manual its says.
When i go into the docker and execute the ./devicequery, than it fail on the host. So if this base dockerfile from the manual doesent work, it also doesnt will work to build docker image with opencv cuda.
Maybe someone can help my. My goal is it to deploy applications on host x86 for jetson Xavier. The build image should be load into a docker hub and than i can mange over Open Horizon to deploy them on different Jetson Xavier NX.
And here are my Dockerfiles:
From the Manual:
FROM nvcr.io/nvidia/l4t-base:r32.5.0
RUN apt-get update && apt-get install -y --no-install-recommends make g++
COPY ./samples /tmp/samples
WORKDIR /tmp/samples/1_Utilities/deviceQuery
RUN make clean && make
CMD ["./deviceQuery"]
And my own Dockerfile, which works on the Jetso Xavier, but not on my host system:
FROM nvcr.io/nvidia/l4t-base:r32.5.0
RUN apt-get update && apt-get install -y --no-install-recommends make g++
COPY ./samples /tmp/samples
WORKDIR /tmp/samples/1_Utilities/deviceQuery
RUN make clean && make
WORKDIR /
RUN apt-get install -y build-essential cmake git unzip pkg-config zlib1g-dev && \
apt-get install -y libjpeg-dev libjpeg8-dev libjpeg-turbo8-dev libpng-dev libtiff-dev && \
apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libglew-dev && \
apt-get install -y libgtk2.0-dev libgtk-3-dev libcanberra-gtk* && \
apt-get install -y python-dev python-numpy python-pip && \
apt-get install -y python3-dev python3-numpy python3-pip && \
apt-get install -y libxvidcore-dev libx264-dev libgtk-3-dev && \
apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev libxine2-dev && \
apt-get install -y gstreamer1.0-tools libv4l-dev v4l-utils v4l2ucp qv4l2 && \
apt-get install -y libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev && \
apt-get install -y libavresample-dev libvorbis-dev libxine2-dev libtesseract-dev && \
apt-get install -y libfaac-dev libmp3lame-dev libtheora-dev libpostproc-dev && \
apt-get install -y libopencore-amrnb-dev libopencore-amrwb-dev && \
apt-get install -y libopenblas-dev libatlas-base-dev libblas-dev && \
apt-get install -y liblapack-dev liblapacke-dev libeigen3-dev gfortran && \
apt-get install -y libhdf5-dev protobuf-compiler && \
apt-get install -y libprotobuf-dev libgoogle-glog-dev libgflags-dev && \
apt-get install -y libopenmpi-dev
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.5.zip && \
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.5.zip && \
unzip opencv.zip && \
unzip opencv_contrib.zip && \
mv opencv-4.5.5 opencv && \
mv opencv_contrib-4.5.5 opencv_contrib && \
rm opencv.zip && \
rm opencv_contrib.zip
RUN cd /opencv && mkdir build -p && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
-D WITH_OPENCL=OFF \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=5.3 \
-D CUDA_ARCH_PTX="" \
-D WITH_CUDNN=ON \
-D WITH_CUBLAS=ON \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D OPENCV_DNN_CUDA=ON \
-D ENABLE_NEON=ON \
-D WITH_QT=OFF \
-D WITH_OPENMP=ON \
-D BUILD_TIFF=ON \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D BUILD_TBB=ON \
-D BUILD_TESTS=OFF \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_EXAMPLES=OFF ..
RUN cd /opencv/build && make -j6
#RUN sudo rm -r /usr/include/opencv4/opencv2
RUN cd /opencv/build && make install
RUN ldconfig
RUN cd /opencv/build && make clean
RUN apt-get update
RUN rm -r opencv/
RUN rm -r opencv_contrib/
Thank you very much!