Docker Community Forums

Share and learn in the Docker community.

Build Opencv in Docker with Cuda support

Hi Although I’ve compiled OpenCV in docker with Cuda support in x86 architecture, I couldn’t manage to compile OpenCV in docker for aarch64. I have nvidia’s jetson product like tx2, nx they come with L4T OS and here the docker image link https://ngc.nvidia.com/catalog/containers/nvidia:l4t-base I’ve installed this image on my x86 ubuntu 18.04 PC and run with Quemu to be able to run aarch64 architecture on x86 so I’ve successfully run it and uname -m gives “aarch64” output I am sure image works on x86 so tried to complie OpenCV as usual. Nvidia:l4t base docker image has default Cuda so I didn’t install Cuda in docker image. I have installed OpenCV necessary dependencies. The problem until now is just when I give cmake comment -D WITH_CUDA = ON configuration complete with errors. When I disable -D WITH_CUDA parameter configuration complete without error.

I couldn’t manage to solve this error. The most interesting point is when I run l4t:base docker image on jetson product like tx2 , OpenCV can compile with Cuda support. I follow the same step what i do on x86 based architecture. The error that I mention above

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
    linked by target "opencv_cudev" in directory /home/holi/opencv-3.2.0/modules/cudev
    linked by target "opencv_cudev" in directory /home/holi/opencv-3.2.0/modules/cudev
    linked by target "opencv_test_cudev" in directory /home/holi/opencv-3.2.0/modules/cudev/test
    linked by target "opencv_core" in directory /home/holi/opencv-3.2.0/modules/core
    linked by target "opencv_core" in directory /home/holi/opencv-3.2.0/modules/core
    linked by target "opencv_test_core" in directory /home/holi/opencv-3.2.0/modules/core
    linked by target "opencv_perf_core" in directory /home/holi/opencv-3.2.0/modules/core
    linked by target "opencv_perf_cudaarithm" in directory /home/holi/opencv-3.2.0/modules/cudaarithm
    linked by target "opencv_test_cudaarithm" in directory /home/holi/opencv-3.2.0/modules/cudaarithm
    linked by target "opencv_cudaarithm" in directory /home/holi/opencv-3.2.0/modules/cudaarithm
    linked by target "opencv_cudaarithm" in directory /home/holi/opencv-3.2.0/modules/cudaarithm
    linked by target "opencv_test_flann" in directory /home/holi/opencv-3.2.0/modules/flann
    linked by target "opencv_flann" in directory /home/holi/opencv-3.2.0/modules/flann
    linked by target "opencv_flann" in directory /home/holi/opencv-3.2.0/modules/flann
    linked by target "opencv_hdf" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/hdf
    linked by target "opencv_hdf" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/hdf
    linked by target "opencv_imgproc" in directory /home/holi/opencv-3.2.0/modules/imgproc
    linked by target "opencv_imgproc" in directory /home/holi/opencv-3.2.0/modules/imgproc
    linked by target "opencv_test_imgproc" in directory /home/holi/opencv-3.2.0/modules/imgproc
    linked by target "opencv_perf_imgproc" in directory /home/holi/opencv-3.2.0/modules/imgproc
    linked by target "opencv_test_ml" in directory /home/holi/opencv-3.2.0/modules/ml
    linked by target "opencv_ml" in directory /home/holi/opencv-3.2.0/modules/ml
    linked by target "opencv_ml" in directory /home/holi/opencv-3.2.0/modules/ml
    linked by target "opencv_test_reg" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/reg
    linked by target "opencv_reg" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/reg
    linked by target "opencv_reg" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/reg
    linked by target "opencv_perf_reg" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/reg
    linked by target "opencv_surface_matching" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/surface_matching
    linked by target "opencv_surface_matching" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/surface_matching
    linked by target "opencv_video" in directory /home/holi/opencv-3.2.0/modules/video
    linked by target "opencv_video" in directory /home/holi/opencv-3.2.0/modules/video
    linked by target "opencv_test_video" in directory /home/holi/opencv-3.2.0/modules/video
    linked by target "opencv_perf_video" in directory /home/holi/opencv-3.2.0/modules/video
    linked by target "opencv_test_cudabgsegm" in directory /home/holi/opencv-3.2.0/modules/cudabgsegm
    linked by target "opencv_cudabgsegm" in directory /home/holi/opencv-3.2.0/modules/cudabgsegm
    linked by target "opencv_cudabgsegm" in directory /home/holi/opencv-3.2.0/modules/cudabgsegm
    linked by target "opencv_perf_cudabgsegm" in directory /home/holi/opencv-3.2.0/modules/cudabgsegm
    linked by target "opencv_test_cudafilters" in directory /home/holi/opencv-3.2.0/modules/cudafilters
    linked by target "opencv_cudafilters" in directory /home/holi/opencv-3.2.0/modules/cudafilters
    linked by target "opencv_cudafilters" in directory /home/holi/opencv-3.2.0/modules/cudafilters
    linked by target "opencv_perf_cudafilters" in directory /home/holi/opencv-3.2.0/modules/cudafilters
    linked by target "opencv_test_cudaimgproc" in directory /home/holi/opencv-3.2.0/modules/cudaimgproc
    linked by target "opencv_perf_cudaimgproc" in directory /home/holi/opencv-3.2.0/modules/cudaimgproc
    linked by target "opencv_cudaimgproc" in directory /home/holi/opencv-3.2.0/modules/cudaimgproc
    linked by target "opencv_cudaimgproc" in directory /home/holi/opencv-3.2.0/modules/cudaimgproc
    linked by target "opencv_test_cudawarping" in directory /home/holi/opencv-3.2.0/modules/cudawarping
    linked by target "opencv_cudawarping" in directory /home/holi/opencv-3.2.0/modules/cudawarping
    linked by target "opencv_cudawarping" in directory /home/holi/opencv-3.2.0/modules/cudawarping
    linked by target "opencv_perf_cudawarping" in directory /home/holi/opencv-3.2.0/modules/cudawarping
    linked by target "opencv_perf_dnn" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/dnn
    linked by target "opencv_dnn" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/dnn
    linked by target "opencv_dnn" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/dnn
    linked by target "opencv_test_dnn" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/dnn
    linked by target "opencv_freetype" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/freetype
    linked by target "opencv_freetype" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/freetype
    linked by target "opencv_test_fuzzy" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/fuzzy
    linked by target "opencv_fuzzy" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/fuzzy
    linked by target "opencv_fuzzy" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/fuzzy
    linked by target "opencv_test_imgcodecs" in directory /home/holi/opencv-3.2.0/modules/imgcodecs
    linked by target "opencv_imgcodecs" in directory /home/holi/opencv-3.2.0/modules/imgcodecs
    linked by target "opencv_imgcodecs" in directory /home/holi/opencv-3.2.0/modules/imgcodecs
    linked by target "opencv_perf_imgcodecs" in directory /home/holi/opencv-3.2.0/modules/imgcodecs
    linked by target "opencv_test_photo" in directory /home/holi/opencv-3.2.0/modules/photo
    linked by target "opencv_photo" in directory /home/holi/opencv-3.2.0/modules/photo
    linked by target "opencv_photo" in directory /home/holi/opencv-3.2.0/modules/photo
    linked by target "opencv_perf_photo" in directory /home/holi/opencv-3.2.0/modules/photo
    linked by target "opencv_test_shape" in directory /home/holi/opencv-3.2.0/modules/shape
    linked by target "opencv_shape" in directory /home/holi/opencv-3.2.0/modules/shape
    linked by target "opencv_shape" in directory /home/holi/opencv-3.2.0/modules/shape
    linked by target "opencv_test_videoio" in directory /home/holi/opencv-3.2.0/modules/videoio
    linked by target "opencv_videoio" in directory /home/holi/opencv-3.2.0/modules/videoio
    linked by target "opencv_videoio" in directory /home/holi/opencv-3.2.0/modules/videoio
    linked by target "opencv_perf_videoio" in directory /home/holi/opencv-3.2.0/modules/videoio
    linked by target "opencv_test_cudacodec" in directory /home/holi/opencv-3.2.0/modules/cudacodec
    linked by target "opencv_cudacodec" in directory /home/holi/opencv-3.2.0/modules/cudacodec
    linked by target "opencv_cudacodec" in directory /home/holi/opencv-3.2.0/modules/cudacodec
    linked by target "opencv_perf_cudacodec" in directory /home/holi/opencv-3.2.0/modules/cudacodec
    linked by target "opencv_test_highgui" in directory /home/holi/opencv-3.2.0/modules/highgui
    linked by target "opencv_highgui" in directory /home/holi/opencv-3.2.0/modules/highgui
    linked by target "opencv_highgui" in directory /home/holi/opencv-3.2.0/modules/highgui
    linked by target "opencv_test_objdetect" in directory /home/holi/opencv-3.2.0/modules/objdetect
    linked by target "opencv_objdetect" in directory /home/holi/opencv-3.2.0/modules/objdetect
    linked by target "opencv_objdetect" in directory /home/holi/opencv-3.2.0/modules/objdetect
    linked by target "opencv_perf_objdetect" in directory /home/holi/opencv-3.2.0/modules/objdetect
    linked by target "opencv_plot" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/plot
    linked by target "opencv_plot" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/plot
    linked by target "opencv_ts" in directory /home/holi/opencv-3.2.0/modules/ts
    linked by target "opencv_ts" in directory /home/holi/opencv-3.2.0/modules/ts
    linked by target "opencv_xobjdetect" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xobjdetect
    linked by target "opencv_xobjdetect" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xobjdetect
    linked by target "opencv_xphoto" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xphoto
    linked by target "opencv_xphoto" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xphoto
    linked by target "opencv_test_xphoto" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xphoto
    linked by target "opencv_perf_xphoto" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xphoto
    linked by target "opencv_test_bgsegm" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bgsegm
    linked by target "opencv_bgsegm" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bgsegm
    linked by target "opencv_bgsegm" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bgsegm
    linked by target "opencv_test_bioinspired" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bioinspired
    linked by target "opencv_bioinspired" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bioinspired
    linked by target "opencv_bioinspired" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bioinspired
    linked by target "opencv_perf_bioinspired" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/bioinspired
    linked by target "opencv_dpm" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/dpm
    linked by target "opencv_dpm" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/dpm
    linked by target "opencv_face" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/face
    linked by target "opencv_face" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/face
    linked by target "opencv_test_face" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/face
    linked by target "opencv_test_features2d" in directory /home/holi/opencv-3.2.0/modules/features2d
    linked by target "opencv_features2d" in directory /home/holi/opencv-3.2.0/modules/features2d
    linked by target "opencv_features2d" in directory /home/holi/opencv-3.2.0/modules/features2d
    linked by target "opencv_perf_features2d" in directory /home/holi/opencv-3.2.0/modules/features2d
    linked by target "opencv_line_descriptor" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/line_descriptor
    linked by target "opencv_line_descriptor" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/line_descriptor
    linked by target "opencv_test_line_descriptor" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/line_descriptor
    linked by target "opencv_perf_line_descriptor" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/line_descriptor
    linked by target "opencv_saliency" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/saliency
    linked by target "opencv_saliency" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/saliency
    linked by target "opencv_test_text" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/text
    linked by target "opencv_text" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/text
    linked by target "opencv_text" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/text
    linked by target "opencv_test_calib3d" in directory /home/holi/opencv-3.2.0/modules/calib3d
    linked by target "opencv_calib3d" in directory /home/holi/opencv-3.2.0/modules/calib3d
    linked by target "opencv_calib3d" in directory /home/holi/opencv-3.2.0/modules/calib3d
    linked by target "opencv_perf_calib3d" in directory /home/holi/opencv-3.2.0/modules/calib3d
    linked by target "opencv_ccalib" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/ccalib
    linked by target "opencv_ccalib" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/ccalib
    linked by target "opencv_test_cudafeatures2d" in directory /home/holi/opencv-3.2.0/modules/cudafeatures2d
    linked by target "opencv_perf_cudafeatures2d" in directory /home/holi/opencv-3.2.0/modules/cudafeatures2d
    linked by target "opencv_cudafeatures2d" in directory /home/holi/opencv-3.2.0/modules/cudafeatures2d
    linked by target "opencv_cudafeatures2d" in directory /home/holi/opencv-3.2.0/modules/cudafeatures2d
    linked by target "opencv_test_cudalegacy" in directory /home/holi/opencv-3.2.0/modules/cudalegacy
    linked by target "opencv_cudalegacy" in directory /home/holi/opencv-3.2.0/modules/cudalegacy
    linked by target "opencv_cudalegacy" in directory /home/holi/opencv-3.2.0/modules/cudalegacy
    linked by target "opencv_perf_cudalegacy" in directory /home/holi/opencv-3.2.0/modules/cudalegacy
    linked by target "opencv_test_cudaobjdetect" in directory /home/holi/opencv-3.2.0/modules/cudaobjdetect
    linked by target "opencv_cudaobjdetect" in directory /home/holi/opencv-3.2.0/modules/cudaobjdetect
    linked by target "opencv_cudaobjdetect" in directory /home/holi/opencv-3.2.0/modules/cudaobjdetect
    linked by target "opencv_perf_cudaobjdetect" in directory /home/holi/opencv-3.2.0/modules/cudaobjdetect
    linked by target "opencv_test_cudaoptflow" in directory /home/holi/opencv-3.2.0/modules/cudaoptflow
    linked by target "opencv_cudaoptflow" in directory /home/holi/opencv-3.2.0/modules/cudaoptflow
    linked by target "opencv_cudaoptflow" in directory /home/holi/opencv-3.2.0/modules/cudaoptflow
    linked by target "opencv_perf_cudaoptflow" in directory /home/holi/opencv-3.2.0/modules/cudaoptflow
    linked by target "opencv_test_cudastereo" in directory /home/holi/opencv-3.2.0/modules/cudastereo
    linked by target "opencv_perf_cudastereo" in directory /home/holi/opencv-3.2.0/modules/cudastereo
    linked by target "opencv_cudastereo" in directory /home/holi/opencv-3.2.0/modules/cudastereo
    linked by target "opencv_cudastereo" in directory /home/holi/opencv-3.2.0/modules/cudastereo
    linked by target "opencv_datasets" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/datasets
    linked by target "opencv_datasets" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/datasets
    linked by target "opencv_test_rgbd" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/rgbd
    linked by target "opencv_rgbd" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/rgbd
    linked by target "opencv_rgbd" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/rgbd
    linked by target "opencv_test_stereo" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/stereo
    linked by target "opencv_stereo" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/stereo
    linked by target "opencv_stereo" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/stereo
    linked by target "opencv_perf_stereo" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/stereo
    linked by target "opencv_superres" in directory /home/holi/opencv-3.2.0/modules/superres
    linked by target "opencv_superres" in directory /home/holi/opencv-3.2.0/modules/superres
    linked by target "opencv_test_superres" in directory /home/holi/opencv-3.2.0/modules/superres
    linked by target "opencv_perf_superres" in directory /home/holi/opencv-3.2.0/modules/superres
    linked by target "opencv_perf_tracking" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/tracking
    linked by target "opencv_test_tracking" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/tracking
    linked by target "opencv_tracking" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/tracking
    linked by target "opencv_tracking" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/tracking
    linked by target "opencv_videostab" in directory /home/holi/opencv-3.2.0/modules/videostab
    linked by target "opencv_videostab" in directory /home/holi/opencv-3.2.0/modules/videostab
    linked by target "opencv_perf_xfeatures2d" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xfeatures2d
    linked by target "opencv_xfeatures2d" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xfeatures2d
    linked by target "opencv_xfeatures2d" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xfeatures2d
    linked by target "opencv_test_xfeatures2d" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/xfeatures2d
    linked by target "opencv_perf_ximgproc" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/ximgproc
    linked by target "opencv_ximgproc" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/ximgproc
    linked by target "opencv_ximgproc" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/ximgproc
    linked by target "opencv_test_ximgproc" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/ximgproc
    linked by target "opencv_aruco" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/aruco
    linked by target "opencv_aruco" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/aruco
    linked by target "opencv_test_aruco" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/aruco
    linked by target "opencv_optflow" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/optflow
    linked by target "opencv_optflow" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/optflow
    linked by target "opencv_perf_optflow" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/optflow
    linked by target "opencv_test_optflow" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/optflow
    linked by target "opencv_test_phase_unwrapping" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/phase_unwrapping
    linked by target "opencv_phase_unwrapping" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/phase_unwrapping
    linked by target "opencv_phase_unwrapping" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/phase_unwrapping
    linked by target "opencv_test_stitching" in directory /home/holi/opencv-3.2.0/modules/stitching
    linked by target "opencv_perf_stitching" in directory /home/holi/opencv-3.2.0/modules/stitching
    linked by target "opencv_stitching" in directory /home/holi/opencv-3.2.0/modules/stitching
    linked by target "opencv_stitching" in directory /home/holi/opencv-3.2.0/modules/stitching
    linked by target "opencv_test_structured_light" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/structured_light
    linked by target "opencv_structured_light" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/structured_light
    linked by target "opencv_structured_light" in directory /home/holi/opencv-3.2.0/opencv_contrib-3.2.0/modules/structured_light
    linked by target "opencv_traincascade" in directory /home/holi/opencv-3.2.0/apps/traincascade
    linked by target "opencv_createsamples" in directory /home/holi/opencv-3.2.0/apps/createsamples
    linked by target "opencv_annotation" in directory /home/holi/opencv-3.2.0/apps/annotation
    linked by target "opencv_visualisation" in directory /home/holi/opencv-3.2.0/apps/visualisation
    linked by target "opencv_interactive-calibration" in directory /home/holi/opencv-3.2.0/apps/interactive-calibration
    linked by target "opencv_version" in directory /home/holi/opencv-3.2.0/apps/version
    linked by target "cpp-tutorial-pnp_detection" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_edge" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_npr_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_stitching_detailed" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_houghlines" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "cpp-tutorial-pnp_registration" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_lsd_lines" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_camshiftdemo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_tvl1_optical_flow" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_logistic_regression" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_inpaint" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_intelperc_capture" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_segment_objects" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_3calibration" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_minarea" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_morphology2" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_phase_corr" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_mask_tmpl" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_calibration" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_dft" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_videocapture_starter" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_videowriter_basic" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_shape_example" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_convexhull" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_facedetect" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_fitellipse" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_train_HOG" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_points_classifier" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_demhist" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_stereo_calib" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_letter_recog" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_BasicLinearTransformsTrackbar" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_HoughCircle_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_copyMakeBorder_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_em" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_filestorage_base64" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_calcHist_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_facial_features" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_pca" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_bg_sub" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_stitching" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_AKAZE_match" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_non_linear_svms" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_moments_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_dbt_face_detection" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_generalContours_demo1" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_imagelist_creator" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_planar_tracking" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Morphology_1" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_ffilldemo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_filestorage" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_grabcut" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_video-write" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_neural_network" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_delaunay2" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Geometric_Transforms_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_autofocus" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_hull_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_videocapture_basic" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_cloning_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_fback" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_pointPolygonTest_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_filter2D_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_connected_components" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_findContours_demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_peopledetect" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_contours2" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_EqualizeHist_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_image_alignment" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Laplace_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Threshold_inRange" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_CannyDetector_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_openni_capture" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_how_to_scan_images" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_create_mask" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_generalContours_demo2" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_watershed" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_kmeans" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_detect_blob" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_tree_engine" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_bgfg_segm" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_houghcircles" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_interoperability_with_OpenCV_1" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_LATCH_match" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Threshold" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_stereo_match" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_compareHist_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_cornerHarris_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_introduction_windows_vs" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_laplace" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_calcBackProject_Demo1" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_opencv_version" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_gpu-basics-similarity" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_cornerSubPix_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Morphology_2" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_objectDetection2" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_smiledetect" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_Remap_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "example_select3dobj" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_cornerDetector_Demo" in directory /home/holi/opencv-3.2.0/samples/cpp
    linked by target "tutorial_BasicLinearTransforms" in directory /home/holi/opencv-3.2.0/samples/cpp

-- Configuring incomplete, errors occurred!
See also "/opt/opencv-3.1.0/build/CMakeFiles/CMakeOutput.log".
See also "/opt/opencv-3.1.0/build/CMakeFiles/CMakeError.log".

FROM smartuav_px4:latest --> this image is fist built with nvidia/cudagl:10.2-devel-ubuntu18.04

#copy paste from other image , some useless packages. TODO : clean
USER root
WORKDIR /
RUN apt-get -qq -y update && apt-get -qq -y install
build-essential
git
cmake
python3
python3-pip
python3-numpy
libtbb2
libtbb-dev
libcudnn7-dev
libeigen3-dev
libgtk2.0-dev
pkg-config
libavcodec-dev
libavformat-dev
libswscale-dev
libavresample-dev
libjpeg-dev
libpng-dev
libtiff-dev
libdc1394-22-dev
libv4l-dev
ffmpeg
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
wget
&& apt-get clean
RUN rm -rf /var/lib/apt/lists/* (used \ for the markup)
ENV LD_LIBRARY_PATH="/usr/local/cuda/compat:${LD_LIBRARY_PATH}"

Install OpenCV with CUDA

WORKDIR /opt
RUN wget -q -O opencv.tar.gz https://github.com/opencv/opencv/archive/4.3.0.tar.gz
RUN tar xzvf opencv.tar.gz && rm opencv.tar.gz
RUN wget -q -O opencv_contrib.tar.gz https://github.com/opencv/opencv_contrib/archive/4.3.0.tar.gz
RUN tar xzvf opencv_contrib.tar.gz && rm opencv_contrib.tar.gz
WORKDIR /opt/opencv-4.3.0/build
RUN cmake
-DCMAKE_BUILD_TYPE=RELEASE
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DWITH_CUDA=ON
-DWITH_CUBLAS=ON
-DWITH_CUDNN=ON
-DOPENCV_DNN_CUDA=ON
-DINSTALL_C_EXAMPLES=OFF
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUBLAS=1
-D WITH_FFMPEG=ON
-D WITH_GSTREAMER=ON \
-D ENABLE_PRECOMPILED_HEADERS=OFF
-D CUDA_ARCH_BIN=“5.0 5.2 6.0 6.1 7.0 7.5”
-D INSTALL_PYTHON_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib- 4.3.0/modules -D BUILD_EXAMPLES=OFF …

RUN make -j$(nproc)
RUN make install
RUN rm -rf /opt/opencv_contrib-4.3.0 && rm -rf /opt/opencv-4.3.0

WORKDIR /

Build darknet

RUN set -x;
git clone --recursive https://github.com/pjreddie/darknet.git

#copy the needed files, setting GPU and OPENCV in Makefile
COPY ./yoloFiles/yolov4.cfg /darknet/cfg/
COPY ./yoloFiles/Makefile /darknet/
COPY ./yoloFiles/yolov3-tiny.weights /darknet
COPY ./yoloFiles/yolov3.weights /darknet
COPY ./yoloFiles/yolov4.weights /darknet

RUN cd darknet && make

#dont do the wget, files saved to host for now
#WORKDIR /darknet

download weights full (accurate most) and tiny (faster , less accurate) models

darknet rnns

RUN \

wget https://pjreddie.com/media/files/yolov3.weights; \

wget https://pjreddie.com/media/files/yolov3-tiny.weights; \

wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights

RUN make

test Nvidia docker

CMD nvidia-smi -q

Change terminal prompt

USER user
RUN echo 'export PS1=":whale: [\033[01;32m]\u@$CONTAINER_NAME[\033[00m]:[\033[01;34m]\w[\033[00m

Thank you for your answer but “smartuav_px4:latest” arch. is x86. I was trying to find a solution for arm64 or aarch64 like Nvidia “Linux for Tegra”(L4T) platform. By the way, I solved my problem with re-installation Cuda in docker env.