Opencv build did not generate opencv_world dll and only generates opencv_videoio_ffmpeg490_64 (OpenCV with CUDA))

Hello!

Its my first time trying to build opencv library and im experimenting the same error in

Basically when i do the building process, the opencv_worldXXX.dll isnt generated and I get an error when thying to built a program with Visual Studio. The steps that i have done are the following (same of the following video: https://www.youtube.com/watch?v=-GY2gT2umpk&t=296s)

  1. Download opencv latest release, opencv contrib, create a build folder and put them in same directory.

  2. Run CMake gui:
    i) Configure selecting VS code 2019 with x64
    ii) Configure checking these boxes: WITH_CUDA; OPENCV_DNN_CUDA; ENABLE_FAST_MATH; BUILD_opencv_world; Add the modules of contrib file to OPENCV_EXTRA_MODULES_PATH
    iii) Configure checking CUDA_FAST_MATH, changing the values of CUDA_ARCH_BIN to 7.5 (due i have a geforce 1650), and only configurating to Release the CMAKE_CONFIGURATION_TYPES.
    iv) Generate

  3. Run cmake --build “{Path}\build” --target INSTALL --config Release

When it ends, it creates {path}\build\install\x64\vc16\bin directory that only contains this file opencv_videoio_ffmpeg490_64.dll . Why isnt the opencv_world.dll generating, if i have checked the BUILD_opencv_world box? In the cmake GUI terminal also tells some things are missing, but I dont know if they are the source of my error:

  • Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
    OpenJPEG: VERSION = 2.5.0, BUILD = opencv-4.9.0-openjp2-2.5.0
    OpenJPEG libraries will be built from sources: libopenjp2 (version “2.5.0”)

-NVCUVID: Header not found, WITH_NVCUVID requires Nvidia decoding library header C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3/include/nvcuvid.h
-NVCUVENC: Header not found, WITH_NVCUVENC requires Nvidia encoding library header C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3/include/nvEncodeAPI.h

-Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-Could NOT find BLAS (missing: BLAS_LIBRARIES)
-Could NOT find LAPACK (missing: LAPACK_LIBRARIES)
Reason given by package: LAPACK could not be found because dependency BLAS could not be found.

-VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Module opencv_alphamat disabled because the following dependencies are not found: Eigen
freetype2: NO
harfbuzz: NO
-Julia not found. Not compiling Julia Bindings.
-Module opencv_ovis disabled because OGRE3D was not found
-No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract: NO
Processing WORLD modules…
module opencv_cudev…
module opencv_core…
Allocator metrics storage type: ‘long long’
Excluding from source files list: /modules/world/test/test_intrin256.lasx.cpp
module opencv_cudaarithm…
module opencv_flann…
module opencv_imgproc…
module opencv_intensity_transform…
module opencv_ml…
module opencv_phase_unwrapping…
module opencv_plot…
module opencv_quality…
module opencv_reg…
module opencv_signal…
module opencv_surface_matching…
module opencv_cudafilters…
module opencv_cudaimgproc…
module opencv_cudawarping…
module opencv_dnn…

What is the error you get when building and what is the full CMake configuration output underneath

--
-- General configuration for OpenCV

This are the errors that appears when I try to build for opencv:

image

General configuration for OpenCV 4.9.0 =====================================
Version control: unknown

Extra modules:
Location (extra): D:/OpenCV_con_CUDA_full_RyD/opencv_contrib-4.x/modules
Version control (extra): unknown

Platform:
Timestamp: 2024-02-08T15:15:52Z
Host: Windows 10.0.19045 AMD64
CMake: 3.28.2
CMake generator: Visual Studio 17 2022
CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
MSVC: 1938
Configuration: Debug 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 (18 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 (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (38 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (8 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: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe (ver 19.38.33135.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /O2 /Ob2 /DNDEBUG
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /O2 /Ob2 /DNDEBUG
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:fast /MP /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
ccache: NO
Precompiled headers: NO
Extra dependencies: cudart_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3/lib/x64
3rdparty dependencies:

OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape signal stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode world xfeatures2d ximgproc xobjdetect xphoto
Disabled: -
Disabled by dependency: -
Unavailable: alphamat cannops cvv freetype hdf java julia matlab ovis python2 python3 sfm viz
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO

Windows RT support: NO

GUI:
Win32 UI: YES
VTK support: NO

Media I/O:
ZLib: build (ver 1.3)
JPEG: build-libjpeg-turbo (ver 2.1.3-62)
SIMD Support Request: YES
SIMD Support: NO
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.2.0)
JPEG 2000: build (ver 2.5.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: YES (4.0.0)
GStreamer: NO
DirectShow: YES
Media Foundation: YES
DXVA: YES

Parallel framework: Concurrency

Trace: YES (with Intel ITT)

Other third-party libraries:
Intel IPP: 2021.11.0 [2021.11.0]
at: D:/OpenCV_con_CUDA_full_RyD/build/3rdparty/ippicv/ippicv_win/icv
Intel IPP IW: sources (2021.11.0)
at: D:/OpenCV_con_CUDA_full_RyD/build/3rdparty/ippicv/ippicv_win/iw
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.19.1)
Flatbuffers: builtin/3rdparty (23.5.9)

NVIDIA CUDA: YES (ver 12.3, CUFFT CUBLAS FAST_MATH)
NVIDIA GPU arch: 75
NVIDIA PTX archs: 75

cuDNN: YES (ver 9.0.0)

OpenCL: YES (NVD3D11)
Include path: D:/OpenCV_con_CUDA_full_RyD/opencv-4.9.0/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python (for build): C:/Users/FranciscoAguilera/AppData/Local/Microsoft/WindowsApps/python3.exe

Java:
ant: NO
Java: YES (ver 1.8.0.341)
JNI: C:/Program Files/Java/jdk1.8.0_341/include C:/Program Files/Java/jdk1.8.0_341/include/win32 C:/Program Files/Java/jdk1.8.0_341/include
Java wrappers: NO
Java tests: NO

Install to: D:/OpenCV_con_CUDA_full_RyD/build/install

The errors from the output window. I want to see the first error which is generated along with the associated text please.

If i built using the following command:
cmake --build “{Path}\build” --target INSTALL --config Release
No error windows pop up, but in the cmd a red warning appears (translated):

error C3861: ‘cudnnSetRNNDescriptor_v6’: identifier not found [C:\Users\FranciscoAguilera\Documents\Op
enCV_CUDA_Full\build\modules\world\opencv_world.vcxproj]

Also, there is no “/install” directory created, so i cant add the bin folder to the path:

I dont understand what I have done. Now Im running another compile using Visual Studio 2022, Built ALL_BUILD and then INSTALL. Once is done, i can show you what i get

I built with VS and the same error messages appears that I show at the start of the post. Building with Visual studio creates de /install folder and I get the bin and lib folder, so I add them to the Path in env. variables. Now, if i try to build and run this code:

CMake:

cmake_minimum_required(VERSION 3.0.0)
project(test_opencv VERSION 0.1.0)

include(CTest)
enable_testing()

find_package( OpenCV REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS} )

add_executable(test_opencv main.cpp)

target_link_libraries( test_opencv ${OpenCV_LIBS})

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

main.cpp:

#include <iostream>
#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <opencv2/core/cuda.hpp>

using namespace std;
using namespace cv;
using namespace dnn;
using namespace cuda;

int main(int, char**) {

    printCudaDeviceInfo(0);

    cout << "Hello, world!\n";
}

The following errors shows up:

It look like OpenCV doesn’t support cuDNN 9.0.

I suggest using 8.9.7 instead which I don’t doesn’t generate the above error on my system.

Thank you, I changed cudnn version, restart PC and it worked!!!
After a week trying to install opencv with cuda im so happy to finally work. Really apreciate your help

1 Like