I am unable to build Opencv 4.5.1 from source with Contrib modules. Tracing the build error in terminal looks like this:
[ 13%] Building CXX object modules/cudev/CMakeFiles/opencv_cudev.dir/src/stub.cpp.o
[ 13%] Linking CXX shared library β¦/β¦/lib/libopencv_cudev.so
[ 13%] Building CXX object modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/conditioning.cc.o
[ 13%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfIO.cpp.o
/usr/bin/ld: cannot find -lfalse
/usr/bin/ld: cannot find -lfalse
collect2: error: ld returned 1 exit status
modules/cudev/CMakeFiles/opencv_cudev.dir/build.make:98: recipe for target βlib/libopencv_cudev.so.4.5.1β failed
make[2]: *** [lib/libopencv_cudev.so.4.5.1] Error 1
CMakeFiles/Makefile2:4140: recipe for target βmodules/cudev/CMakeFiles/opencv_cudev.dir/allβ failed
make[1]: *** [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2
make[1]: *** Waiting for unfinished jobsβ¦
My cmake command looks like this:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_C_COMPILER=/usr/bin/gcc-6 \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D WITH_TBB=OFF \
-D WITH_CUDA=ON \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.1 \
-D BUILD_opencv_cudacodec=OFF \
-D BUILD_SHARED_LIBS=ON \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_V4L=OFF \
-D WITH_QT=OFF \
-D WITH_OPENGL=OFF \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_PC_FILE_NAME=opencv.pc \
-D OPENCV_ENABLE_NONFREE=OFF \
-D WITH_CUDNN=ON \
-D OPENCV_DNN_CUDA=ON \
-D CUDA_nppicom_LIBRARY=false \
-D HAVE_opencv_python3=OFF \
-D ENABLE_PRECOMPILED_HEADERS=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/home/user/Videos/opencv_contrib-4.5.1/modules \
-D CUDA_ARCH_BIN="${CUDA_ARCH_BIN}" \
-D BUILD_TIFF=OFF \
-D BUILD_EXAMPLES=OFF ..
After successfully generating the configuration, the result:
> -D CMAKE_C_COMPILER=/usr/bin/gcc-6
> -D CMAKE_INSTALL_PREFIX=/usr/local
> -D INSTALL_C_EXAMPLES=OFF
> -D WITH_TBB=OFF
> -D WITH_CUDA=ON
> -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.1
> -D BUILD_opencv_cudacodec=OFF
> -D BUILD_SHARED_LIBS=ON
> -D ENABLE_FAST_MATH=1
> -D CUDA_FAST_MATH=1
> -D WITH_CUBLAS=1
> -D WITH_V4L=OFF
> -D WITH_QT=OFF
> -D WITH_OPENGL=OFF
> -D WITH_GSTREAMER=ON
> -D OPENCV_GENERATE_PKGCONFIG=ON
> -D OPENCV_PC_FILE_NAME=opencv.pc
> -D OPENCV_ENABLE_NONFREE=OFF
> -D WITH_CUDNN=ON
> -D OPENCV_DNN_CUDA=ON
> -D CUDA_nppicom_LIBRARY=false
> -D HAVE_opencv_python3=OFF
> -D ENABLE_PRECOMPILED_HEADERS=OFF
> -D OPENCV_EXTRA_MODULES_PATH=/home/user/Videos/opencv_contrib-4.5.1/modules
> -D CUDA_ARCH_BIN="${CUDA_ARCH_BIN}"
> -D BUILD_TIFF=OFF
> -D BUILD_EXAMPLES=OFF β¦
β Detected processor: x86_64
β Looking for ccache - not found
β Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version β1.2.11β, minimum required is β1.2.3β)
Cleaning INTERNAL cached variable: TIFF_LIBRARY
Cleaning INTERNAL cached variable: TIFF_INCLUDE_DIR
β Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
Cleaning INTERNAL cached variable: WEBP_LIBRARY
Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
β Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
β OpenJPEG: VERSION = 2.3.1, BUILD = opencv-4.5.1-openjp2-2.3.1
β OpenJPEG libraries will be built from sources: libopenjp2 (version β2.3.1β)
β Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version β1.2.11β)
β found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
β at: /home/user/Videos/opencv-4.5.1/release/3rdparty/ippicv/ippicv_lnx/icv
β found Intel IPP Integration Wrappers sources: 2020.0.0
β at: /home/user/Videos/opencv-4.5.1/release/3rdparty/ippicv/ippicv_lnx/iw
β CUDA detected: 11.1
β CUDA NVCC target flags: -D_FORCE_INLINES
β Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
β Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
β Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
β Could NOT find Pylint (missing: PYLINT_EXECUTABLE)
β Could NOT find Flake8 (missing: FLAKE8_EXECUTABLE)
β VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
β OpenCV Python: during development append to PYTHONPATH: /home/user/Videos/opencv-4.5.1/release/python_loader
β Checking for module βlibavresampleβ
β No package βlibavresampleβ found
β Caffe: NO
β Protobuf: NO
β Glog: YES
β freetype2: YES (ver 21.0.15)
β harfbuzz: YES (ver 1.7.2)
β Julia not found. Not compiling Julia Bindings.
β Module opencv_ovis disabled because OGRE3D was not found
β CERES support is disabled. Ceres Solver for reconstruction API is required.
β Tesseract: YES (ver 4.1.0)
β Allocator metrics storage type: βlong longβ
β Registering hook βINIT_MODULE_SOURCES_opencv_dnnβ: /home/user/Videos/opencv-4.5.1/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
β rgbd: CERES support is disabled. Ceres Solver is Required for Posegraph optimization
β CERES support is disabled. Ceres Solver for reconstruction API is required.
β
β General configuration for OpenCV 4.5.1 =====================================
β Version control: unknown
β
β Extra modules:
β Location (extra): /home/user/Videos/opencv_contrib-4.5.1/modules
β Version control (extra): unknown
β
β Platform:
β Timestamp: 2021-03-04T17:33:25Z
β Host: Linux 4.15.0-132-generic x86_64
β CMake: 3.20.0-rc2
β CMake generator: Unix Makefiles
β CMake build tool: /usr/bin/make
β Configuration: RELEASE
β
β CPU/HW features:
β Baseline: SSE SSE2 SSE3
β requested: SSE3
β Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
β requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
β SSE4_1 (17 files): + SSSE3 SSE4_1
β SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
β FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
β AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
β AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
β AVX512_SKX (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
β
β C/C++:
β Built as dynamic libs?: YES
β C++ standard: 11
β C++ Compiler: /usr/bin/c++ (ver 7.5.0)
β C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
β C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
β C Compiler: /usr/bin/gcc-6
β C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
β C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
β Linker flags (Release): -Wl,βexclude-libs,libippicv.a -Wl,βexclude-libs,libippiw.a -Wl,βgc-sections -Wl,βas-needed
β Linker flags (Debug): -Wl,βexclude-libs,libippicv.a -Wl,βexclude-libs,libippiw.a -Wl,βgc-sections -Wl,βas-needed
β ccache: NO
β Precompiled headers: NO
β Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc false nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-11.1/lib64 -L/usr/lib/x86_64-linux-gnu
β 3rdparty dependencies:
β
β OpenCV modules:
β To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
β Disabled: cudacodec world
β Disabled by dependency: -
β Unavailable: cnn_3dobj cvv java julia matlab ovis viz
β Applications: tests perf_tests apps
β Documentation: NO
β Non-free algorithms: NO
β
β GUI:
β GTK+: YES (ver 3.22.30)
β GThread : YES (ver 2.56.4)
β GtkGlExt: NO
β VTK support: NO
β
β Media I/O:
β ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
β JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
β WEBP: build (ver encoder: 0x020f)
β PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
β TIFF: build (ver 42 - 4.0.10)
β JPEG 2000: build (ver 2.3.1)
β OpenEXR: build (ver 2.3.0)
β HDR: YES
β SUNRASTER: YES
β PXM: YES
β PFM: YES
β
β Video I/O:
β DC1394: YES (2.2.5)
β FFMPEG: YES
β avcodec: YES (56.60.100)
β avformat: YES (56.40.101)
β avutil: YES (54.31.100)
β swscale: YES (3.1.101)
β avresample: NO
β GStreamer: YES (1.14.5)
β
β Parallel framework: pthreads
β
β Trace: YES (with Intel ITT)
β
β Other third-party libraries:
β Intel IPP: 2020.0.0 Gold [2020.0.0]
β at: /home/user/Videos/opencv-4.5.1/release/3rdparty/ippicv/ippicv_lnx/icv
β Intel IPP IW: sources (2020.0.0)
β at: /home/user/Videos/opencv-4.5.1/release/3rdparty/ippicv/ippicv_lnx/iw
β Lapack: NO
β Eigen: YES (ver 3.3.4)
β Custom HAL: NO
β Protobuf: build (3.5.1)
β
β NVIDIA CUDA: YES (ver 11.1, CUFFT CUBLAS FAST_MATH)
β NVIDIA GPU arch:
β NVIDIA PTX archs:
β
β cuDNN: YES (ver 8.0.5)
β
β OpenCL: YES (no extra features)
β Include path: /home/user/Videos/opencv-4.5.1/3rdparty/include/opencl/1.2
β Link libraries: Dynamic load
β
β Python 2:
β Interpreter: /usr/bin/python2.7 (ver 2.7.17)
β Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.17)
β numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.1)
β install path: lib/python2.7/dist-packages/cv2/python-2.7
β
β Python 3:
β Interpreter: /usr/bin/python3 (ver 3.6.9)
β Libraries: NO
β numpy: /home/user/.local/lib/python3.6/site-packages/numpy/core/include (ver 1.18.0)
β install path: -
β
β Python (for build): /usr/bin/python2.7
β
β Java:
β ant: NO
β JNI: /usr/lib/jvm/java-8-openjdk-amd64/include /usr/lib/jvm/java-8-openjdk-amd64/include/linux /usr/lib/jvm/java-8-openjdk-amd64/include
β Java wrappers: NO
β Java tests: NO
β
β Install to: /usr/local
β -----------------------------------------------------------------
β
β Configuring done
β Generating done
β Build files have been written to: /home/user/Videos/opencv-4.5.1/release
I am so confused that /usr/bin/ld: cannot find -lfalse
error points to not finding libfalse
but I couldnβt find any library like this after hours of Googling. Please help.