Hi everyone,
I attempted to build OpenCV on Windows 10, but I encountered errors during the compilation process. I tried both CMake and CMake-GUI, but I kept getting errors. Here is my configuration:
"C:\Program Files\CMake\bin\cmake.exe" ^
-H"E:/opencv/opencv" ^
-DOPENCV_EXTRA_MODULES_PATH="E:/opencv/opencv_contrib/modules" ^
-B"E:/opencv/opencv_build" ^
-G"Visual Studio 17 2022" ^
-A x64 ^
-DCMAKE_BUILD_TYPE=Release ^
-DINSTALL_TESTS=ON ^
-DINSTALL_C_EXAMPLES=ON ^
-DBUILD_EXAMPLES=ON ^
-DBUILD_opencv_world=ON ^
-DENABLE_CUDA_FIRST_CLASS_LANGUAGE=ON ^
-DWITH_CUDA=ON ^
-DWITH_CUDNN=ON ^
-DCUDA_GENERATION=Auto ^
-DBUILD_opencv_python3=ON ^
-DPYTHON3_INCLUDE_DIR="C:/ProgramData/anaconda3/envs/opencv_py311/include" ^
-DPYTHON3_LIBRARY="C:/ProgramData/anaconda3/envs/opencv_py311/libs/python37.lib" ^
-DPYTHON3_EXECUTABLE="C:/ProgramData/anaconda3/envs/opencv_py311/python.exe" ^
-DPYTHON3_NUMPY_INCLUDE_DIRS="C:/ProgramData/anaconda3/envs/opencv_py311/Lib/site-packages/numpy/core/include" ^
-DPYTHON3_PACKAGES_PATH="C:/ProgramData/anaconda3/envs/opencv_py311/Lib/site-packages"
However, generating the .pyd
file doesn’t work.
Is there a better way? Please, I need help.
I can confirm that my CUDA and cuDNN installations are okay.
Can you share your build errors and your CMake configuration output?
See the below guide for an example
Note: CUDA 12.6 is not yet supported and CUDA 12.5 requires the latest commits from the 4.x branches of both OpenCV repos.
Yes, I did refer to that post, but unfortunately,
I wasn’t successful. I’m certain that I’m using CUDA version 12.5 and the latest master branch of OpenCV.
I apologize for not being able to provide the build error from that time, as I have already regenerated the solution using CMake GUI.
I’m currently in the process of building it.
I’ll provide a generation log for now.
General configuration for OpenCV 4.10.0-dev =====================================
Version control: 4.10.0-228-gf4c2e4f872
Extra modules:
Location (extra): E:/opencv/opencv_contrib/modules
Version control (extra): 4.10.0-13-g94cda4b1
Platform:
Timestamp: 2024-08-27T06:37:09Z
Host: Windows 10.0.19045 AMD64
CMake: 3.22.0-rc1
CMake generator: Visual Studio 17 2022
CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Professional/MSBuild/Current/Bin/amd64/MSBuild.exe
MSVC: 1941
Configuration: Release
Algorithm Hint: ALGO_HINT_ACCURATE
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: 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
AVX (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX FP16
AVX2 (38 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX FP16 AVX2 FMA3
AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX FP16 AVX2 FMA3 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/Professional/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe (ver 19.41.34120.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/Professional/VC/Tools/MSVC/14.41.34120/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.5/lib/x64
3rdparty dependencies:
OpenCV modules:
To be built: alphamat 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 hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm 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: cannops cvv freetype java julia matlab ovis python2 python2 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.1)
JPEG: build-libjpeg-turbo (ver 3.0.3-70)
SIMD Support Request: YES
SIMD Support: NO
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.43)
SIMD Support Request: YES
SIMD Support: YES (Intel SSE)
TIFF: build (ver 42 - 4.6.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: YES (1.18.5)
DirectShow: YES
Media Foundation: YES
DXVA: YES
Parallel framework: Concurrency
Trace: YES (with Intel ITT)
Other third-party libraries:
Intel IPP: 2021.12.0 [2021.12.0]
at: E:/opencv/opencv_build/3rdparty/ippicv/ippicv_win/icv
Intel IPP IW: sources (2021.12.0)
at: E:/opencv/opencv_build/3rdparty/ippicv/ippicv_win/iw
Lapack: NO
Eigen: YES (ver 3.4.0)
Custom HAL: NO
Protobuf: build (3.19.1)
Flatbuffers: builtin/3rdparty (23.5.9)
NVIDIA CUDA: YES (ver 12.5, CUFFT CUBLAS NVCUVID NVCUVENC)
NVIDIA GPU arch: 50 52 60 61 70 75 80 86 89 90
NVIDIA PTX archs: 86
cuDNN: YES (ver 8.9.7)
OpenCL: YES (NVD3D11)
Include path: E:/opencv/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 3:
Interpreter: C:/ProgramData/anaconda3/envs/opencv_py311/python.exe (ver 3.12.3)
Libraries: C:/ProgramData/anaconda3/libs/python312.lib (ver 3.12.3)
Limited API: NO
numpy: C:/ProgramData/anaconda3/envs/opencv_py311/Lib/site-packages/numpy/_core/include (ver 1.26.4)
install path: C:/ProgramData/anaconda3/envs/opencv_py311/Lib/site-packages/cv2/python-3.12
Python (for build): C:/ProgramData/anaconda3/envs/opencv_py311/python.exe
Install to: E:/opencv/opencv_build/install
-----------------------------------------------------------------
Thank you for your response, much appreciated!
I wouldn’t use the GUI for CUDA.
Alright then, thank you. I wish you all the best!
Hello everyone, I have now resolved this issue.
I referred to this:
https://github.com/cudawarped/opencv-python-cuda-wheels/releases
I downloaded the .whl
file and installed it.
Apart from the mismatch in compute capability, everything else is at least working fine.
1 Like