Error C2664 nppiMeanStdDevGetBufferHostSize_8u_C1R
System information (version)
- OpenCV => 4.9.0
- Operating System / Platform => Windows 11 Pro 64 Bit 10.0.22631
- Compiler => Visual Studio 2022 MSVC LTSC v17.8.9
- CL version => 19.38.33136
- C++ standard => 17
- Cmake version => 3.26.4
- CUDA version => 11.8.89
- cuDNN version => 8.9.7
- NVCUVID version => 12.1.14
Detailed description
I want to build the opencv package with CUDA support, now I using anaconda build with the edited recipe, but the I went the issue about this opencv_contrib. It seems that the type of the parameter of this nppiMeanStdDevGetBufferHostSize_8u_C1R
function is worng with cannot convert argument 2 from 'int *' to 'size_t *
. It may be the problem of source code, I think it is not a question.
Just like the following log shows:
Could any one can help me to figure out this.
The log of the error
[556/2115] Building CXX object modules\cudaarithm\CMakeFiles\opencv_cudaarithm.dir\src\reductions.cpp.obj
FAILED: modules/cudaarithm/CMakeFiles/opencv_cudaarithm.dir/src/reductions.cpp.obj
"C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe" /nologo /TP -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -D_WIN32_WINNT=0x0601 -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I%SRC_DIR%\build\3rdparty\ippicv\ippicv_win\icv\include -I%SRC_DIR%\build\3rdparty\ippicv\ippicv_win\iw\include -I%SRC_DIR%\build -I%SRC_DIR%\opencv_contrib\modules\cudaarithm\include -I%SRC_DIR%\build\modules\cudaarithm -I%SRC_DIR%\opencv_contrib\modules\cudev\include -I%SRC_DIR%\modules\core\include -external:I%PREFIX%\Library\include -external:I%BUILD_PREFIX%\include -external:I%PREFIX%\Library\include\eigen3 -external:W0 -D_CRT_USE_C_COMPLEX_H /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 /FS /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /wd4127 /wd4324 /wd4512 /O2 /Ob2 /DNDEBUG -std:c++17 -MD /showIncludes /Fomodules\cudaarithm\CMakeFiles\opencv_cudaarithm.dir\src\reductions.cpp.obj /Fdlib\opencv_cudaarithm490.pdb /FS -c %SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(159): error C2664: 'NppStatus nppiMeanStdDevGetBufferHostSize_8u_C1R(NppiSize,size_t *)': cannot convert argument 2 from 'int *' to 'size_t *'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(159): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
%BUILD_PREFIX%\include\nppi_statistics_functions.h(5350): note: see declaration of 'nppiMeanStdDevGetBufferHostSize_8u_C1R'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(159): note: while trying to match the argument list '(NppiSize, int *)'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(161): error C2664: 'NppStatus nppiMeanStdDevGetBufferHostSize_32f_C1R(NppiSize,size_t *)': cannot convert argument 2 from 'int *' to 'size_t *'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(161): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
%BUILD_PREFIX%\include\nppi_statistics_functions.h(5401): note: see declaration of 'nppiMeanStdDevGetBufferHostSize_32f_C1R'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(161): note: while trying to match the argument list '(NppiSize, int *)'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(235): error C2664: 'NppStatus nppiMeanStdDevGetBufferHostSize_8u_C1MR(NppiSize,size_t *)': cannot convert argument 2 from 'int *' to 'size_t *'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(235): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
%BUILD_PREFIX%\include\nppi_statistics_functions.h(5418): note: see declaration of 'nppiMeanStdDevGetBufferHostSize_8u_C1MR'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(235): note: while trying to match the argument list '(NppiSize, int *)'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(237): error C2664: 'NppStatus nppiMeanStdDevGetBufferHostSize_32f_C1MR(NppiSize,size_t *)': cannot convert argument 2 from 'int *' to 'size_t *'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(237): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
%BUILD_PREFIX%\include\nppi_statistics_functions.h(5469): note: see declaration of 'nppiMeanStdDevGetBufferHostSize_32f_C1MR'
%SRC_DIR%\opencv_contrib\modules\cudaarithm\src\reductions.cpp(237): note: while trying to match the argument list '(NppiSize, int *)'
Build configration
-- Building with NVIDIA Optical Flow API 2.0
--
-- General configuration for OpenCV 4.9.0 =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/work/opencv_contrib/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2024-04-22T10:26:15Z
-- Host: Windows 10.0.22631 AMD64
-- CMake: 3.26.4
-- CMake generator: Ninja
-- CMake build tool: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/Library/bin/ninja.exe
-- MSVC: 1938
-- 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 (16 files): + SSSE3 SSE4_1
-- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (36 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (5 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: 17
-- C++ Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe (ver 19.38.33136.0)
-- C++ flags (Release): -D_CRT_USE_C_COMPLEX_H /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 /FS /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /O2 /Ob2 /DNDEBUG
-- C++ flags (Debug): -D_CRT_USE_C_COMPLEX_H /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 /FS /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /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 /FS /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 /FS /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: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/cudart_static.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppial.lib C:/Users/Makoto/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppc.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppitc.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppig.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppist.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppidei.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/cublas.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/cublasLt.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/cufft.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppicc.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppif.lib C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_build_env/lib/x64/nppim.lib
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: alphamat aruco bgsegm calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform java line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: bioinspired world
-- Disabled by dependency: -
-- Unavailable: cannops julia matlab ovis python2 sfm ts viz
-- Applications: apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- Windows RT support: NO
--
-- GUI: QT6
-- QT: YES (ver 6.6.3 )
-- QT OpenGL support: YES (Qt6::OpenGL )
-- OpenGL support: YES (opengl32 glu32)
--
-- Media I/O:
-- ZLib: zlib (ver 1.3)
-- JPEG: build-libjpeg-turbo (ver 2.1.3-62)
-- SIMD Support Request: YES
-- SIMD Support: YES
-- WEBP: build (ver encoder: 0x020f)
-- PNG: build (ver 1.6.37)
-- TIFF: build (ver 42 - 4.2.0)
-- JPEG 2000: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/Library/lib/jasper.lib (ver 4.2.3)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- FFMPEG: YES (prebuilt binaries)
-- avcodec: YES (60.31.102)
-- avformat: YES (60.16.100)
-- avutil: YES (58.29.100)
-- swscale: YES (7.5.100)
-- avresample: 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: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/work/build/3rdparty/ippicv/ippicv_win/icv
-- Intel IPP IW: sources (2021.11.0)
-- at: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/work/build/3rdparty/ippicv/ippicv_win/iw
-- Lapack: YES (C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/Library/lib/lapack.lib C:/Users/Makoto/miniconda3/conda-bld/libopencv_1713780749807/_h_env/Library/lib/cblas.lib)
-- OpenVINO: YES (2024.0.0)
-- Eigen: YES (ver 3.4.0)
-- Custom HAL: NO
-- Protobuf: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/Library/bin/libprotobuf.dll (25.3.0)
-- Flatbuffers: builtin/3rdparty (23.5.9)
--
-- NVIDIA CUDA: YES (ver 11.8.89, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
-- NVIDIA GPU arch: 35 37 50 52 60 61 70 75 80 86 89 90
-- NVIDIA PTX archs: 90
--
-- cuDNN: YES (ver 8.9.7)
--
-- OpenCL: YES (NVD3D11)
-- Include path: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/work/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/python (ver 3.11.9)
-- Libraries: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/libs/python311.lib (ver 3.11.9)
-- numpy: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/lib/site-packages/numpy/core/include (ver 1.26.4)
-- install path: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/Lib/site-packages
--
-- Python (for build): C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/python
--
-- Java:
-- ant: NO
-- Java: YES (ver 17.0.8)
-- JNI: C:/Program Files/Microsoft/jdk-17.0.8.101-hotspot/include C:/Program Files/Microsoft/jdk-17.0.8.101-hotspot/include/win32 C:/Program Files/Microsoft/jdk-17.0.8.101-hotspot/include
-- Java wrappers: YES (JAVA)
-- Java tests: NO
--
-- Install to: C:/Users/Dev/miniconda3/conda-bld/libopencv_1713780749807/_h_env/Library
-- -----------------------------------------------------------------
Steps to reproduce
Download the source code from github acrhive of this version
build it with these cmake command
cmake -LAH -G "Ninja" ^
-DCMAKE_CXX_STANDARD=17 ^
-DCMAKE_BUILD_TYPE="Release" ^
-DCMAKE_INSTALL_PREFIX=%UNIX_LIBRARY_PREFIX% ^
-DCMAKE_PREFIX_PATH=%UNIX_LIBRARY_PREFIX% ^
-DOPENCV_CONFIG_INSTALL_PATH=cmake ^
-DOPENCV_BIN_INSTALL_PATH=bin ^
-DOPENCV_LIB_INSTALL_PATH=lib ^
-DOPENCV_GENERATE_SETUPVARS=OFF ^
-DOPENCV_DOWNLOAD_TRIES=1;2;3;4;5 ^
-DOPENCV_DOWNLOAD_PARAMS=INACTIVITY_TIMEOUT;30;TIMEOUT;180;SHOW_PROGRESS ^
-DWITH_LAPACK=1 ^
-DLAPACK_INCLUDE_DIR=%UNIX_LIBRARY_INC% ^
-DLAPACK_LAPACKE_H=lapacke.h ^
-DLAPACK_CBLAS_H=cblas.h ^
-DLAPACK_LIBRARIES=%UNIX_LIBRARY_LIB%/lapack.lib;%UNIX_LIBRARY_LIB%/cblas.lib ^
-DWITH_EIGEN=1 ^
-DENABLE_CONFIG_VERIFICATION=ON ^
-DENABLE_PRECOMPILED_HEADERS=OFF ^
-DBUILD_TESTS=0 ^
-DBUILD_DOCS=0 ^
-DBUILD_PERF_TESTS=0 ^
-DBUILD_ZLIB=1 ^
-DBUILD_opencv_bioinspired=0 ^
-DBUILD_TIFF=1 ^
-DBUILD_PNG=1 ^
-DWITH_PROTOBUF=1 ^
-DBUILD_PROTOBUF=0 ^
-DPROTOBUF_UPDATE_FILES=1 ^
-DBUILD_OPENEXR=1 ^
-DWITH_OPENEXR=1 ^
-DBUILD_JASPER=0 ^
-DWITH_JASPER=1 ^
-DWITH_OPENJPEG=0 ^
-DBUILD_JPEG=1 ^
-DCUDA_FAST_MATH=1 ^
-DENABLE_FAST_MATH=1 ^
-DWITH_CUDA=1 ^
-DWITH_CUBLAS=1 ^
-DWITH_OPENGL=1 ^
-DWITH_CUDNN=1 ^
-DWITH_NVCUVID=1 ^
-DWITH_OPENCL=1 ^
-DWITH_OPENCLAMDFFT=0 ^
-DWITH_OPENCLAMDBLAS=0 ^
-DWITH_OPENCL_D3D11_NV=1 ^
-DWITH_OPENVINO=1 ^
-DWITH_1394=0 ^
-DWITH_OPENNI=0 ^
-DWITH_HDF5=1 ^
-DOPENCV_ENABLE_PKG_CONFIG=1 ^
-DWITH_FFMPEG=1 ^
-DWITH_TENGINE=0 ^
-DWITH_GSTREAMER=0 ^
-DWITH_TESSERACT=0 ^
-DWITH_VTK=0 ^
-DWITH_WIN32UI=0 ^
-DENABLE_CUDA_FIRST_CLASS_LANGUAGE=1 ^
-DOPENCV_DNN_CUDA=1 ^
-DCUDA_TOOKIT_ROOT_DIR="%CUDA_PATH%" ^
%WITH_QT% ^
-DINSTALL_C_EXAMPLES=0 ^
-DOPENCV_EXTRA_MODULES_PATH=%UNIX_SRC_DIR%/opencv_contrib/modules ^
-DPYTHON_EXECUTABLE="" ^
-DPYTHON_INCLUDE_DIR="" ^
-DPYTHON_PACKAGES_PATH="" ^
-DPYTHON_LIBRARY="" ^
-DPYTHON_NUMPY_INCLUDE_DIRS="" ^
-DBUILD_opencv_python2=0 ^
-DPYTHON2_EXECUTABLE="" ^
-DPYTHON2_INCLUDE_DIR="" ^
-DPYTHON2_NUMPY_INCLUDE_DIRS="" ^
-DPYTHON2_LIBRARY="" ^
-DPYTHON2_PACKAGES_PATH="" ^
-DOPENCV_PYTHON2_INSTALL_PATH="" ^
-DBUILD_opencv_python3=0 ^
-DPYTHON_EXECUTABLE=%UNIX_PREFIX%/python ^
-DPYTHON_INCLUDE_DIR=%UNIX_PREFIX%/include ^
-DPYTHON_PACKAGES_PATH=%UNIX_SP_DIR% ^
-DPYTHON_LIBRARY=%UNIX_PREFIX%/libs/%PY_LIB% ^
-DPYTHON_NUMPY_INCLUDE_DIRS=%UNIX_SP_DIR%/numpy/core/include ^
-DBUILD_opencv_python3=1 ^
-DOPENCV_SKIP_PYTHON_LOADER=1 ^
-DPYTHON3_EXECUTABLE=%UNIX_PREFIX%/python ^
-DPYTHON3_INCLUDE_DIR=%UNIX_PREFIX%/include ^
-DPYTHON3_NUMPY_INCLUDE_DIRS=%UNIX_SP_DIR%/numpy/core/include ^
-DPYTHON3_LIBRARY=%UNIX_PREFIX%/libs/%PY_LIB% ^
-DPYTHON3_PACKAGES_PATH=%UNIX_SP_DIR% ^
-DOPENCV_PYTHON3_INSTALL_PATH=%UNIX_SP_DIR% ^
-DOPENCV_PYTHON_PIP_METADATA_INSTALL=ON ^
-DOPENCV_PYTHON_PIP_METADATA_INSTALLER:STRING="conda" ^
..
Issue submission checklist
- [x ] I report the issue, it’s not a question
- I checked the problem with documentation, FAQ, open issues,
forum.opencv.org, Stack Overflow, etc and have not found any solution - I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc