Jetson Xavier NX + OpenCV4.5.1

Hi,

I am trying to compile OpenCV-4.5.1 on a Jetson Xavier NX, but it is returning the following error:

[ 50%] Built target opencv_perf_imgproc
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_moments.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_pc.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_resize_bitexact.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_smooth_bitexact.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_subdivision2d.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_templmatch.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_templmatchmask.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_thresh.cpp.o
[ 50%] Linking CXX executable …/…/bin/opencv_test_core
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/test/test_watershed.cpp.o
[ 50%] Built target opencv_test_core
[ 50%] Linking CXX executable …/…/bin/opencv_test_imgproc
[ 50%] Built target opencv_test_imgproc
Makefile:181: recipe for target ‘all’ failed
make: *** [all] Error 2
root@nx:/nx/opencv-4.5.1/build#

I use the following:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=OFF -D INSTALL_C_EXAMPLES=OFF -D WITH_TBB=ON -D WITH_CUDA=ON -D OPENCV_DNN_CUDA=ON -D CUDA_ARCH_BIN=7.2 -D CUDA_ARCH_PTX="" -D BUILD_opencv_cudacodec=OFF -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_V4L=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -D WITH_GSTREAMER=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_PC_FILE_NAME=opencv.pc -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib-master/modules -D BUILD_EXAMPLES=OFF …

Has anyone had trouble compiling version 4.5.1 of OpenCV? Version 4.5.0 works well.

Thanks,
Luis

Maybe you can try this script: GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

1 Like

Thanks dkreutz,

I found the problem, we need to be very careful about the “opencv_contrib”
used!

Thanks,
Luis