使用BUILD_ALL:类类型的字段安装OpenCV错误,而没有在带有DLL接口的类中使用DLL接口(无限循环?)<



我一直在尝试使用源文件,Cmake (gui)和Windows上的Visual Studio安装OpenCV,并遇到一些问题。

系统属性

Windows 10 Enterprise Version 1709 OS Build 16299.2166
GPU = Nvidia Quadro P600(驱动程序版本452.77)CMake 3.19.2
Cuda Toolkit Version 10.1
Microsoft Visual Studio Professional 2017 Version 15.9.31
OpenCV 4.1.0(从Github下载的额外模块为最新版本)
Visual Toolkit Version 7.1

Cmake配置更改列表

BUILD_opencv_world = True;  
OPENCV_EXTRA_MODULES_PATH = ../opencv_contrib-master/modules;  
WITH_CUDA = TRUE  

VTK_DIR边注

我已经安装了VTK,但它不会在Cmake中自动检测到。配置看起来很顺利,但是VTK_DIR被设置为VTK_DIR- notfound。当我手动设置VTK_DIR../vtk/lib/cmake/vtk-7.1时,cmake返回以下错误:

CMake Error at cmake/OpenCVUtils.cmake:1339 (target_link_libraries):
The INTERFACE, PUBLIC or PRIVATE option must appear as the second argument,
just after the target name.
Call Stack (most recent call first):
cmake/OpenCVUtils.cmake:1353 (__ocv_push_target_link_libraries)
cmake/OpenCVModule.cmake:941 (ocv_target_link_libraries)
cmake/OpenCVModule.cmake:850 (_ocv_create_module)
modules/world/CMakeLists.txt:60 (ocv_create_module)

CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1066 (include)

在具有DLL接口的类中使用的没有DLL接口的类类型字段

这是Cmake配置的输出

AVX_512F is not supported by C++ compiler
AVX512_SKX is not supported by C++ compiler
Dispatch optimization AVX512_SKX is not available, skipped
libjpeg-turbo: VERSION = 2.0.2, BUILD = opencv-4.1.0-libjpeg-turbo
found Intel IPP (ICV version): 2019.0.0 [2019.0.0 Gold]
at: C:/Users/byan982/softwarehere/opencv/opencv/build/3rdparty/ippicv/ippicv_win/icv
found Intel IPP Integration Wrappers sources: 2019.0.0
at: C:/Users/byan982/softwarehere/opencv/opencv/build/3rdparty/ippicv/ippicv_win/iw
CUDA detected: 10.1
CUDA NVCC target flags: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES
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.
OpenCV Python: during development append to PYTHONPATH: C:/Users/byan982/softwarehere/opencv/opencv/build/python_loader
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Reason given by package: The command
"C:/cygwin64/bin/pkg-config" --version
failed with output:
stderr: 

result: 
%1 is not a valid Win32 application
Module opencv_alphamat disabled because the following dependencies are not found: Eigen
Caffe:   NO
Protobuf:   NO
Glog:   NO
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...
module opencv_cudaarithm...
module opencv_flann...
module opencv_hdf...
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_surface_matching...
module opencv_cudafilters...
module opencv_cudaimgproc...
module opencv_cudawarping...
module opencv_dnn...
module opencv_dnn_superres...
module opencv_fuzzy...
module opencv_gapi...
module opencv_hfs...
module opencv_imgcodecs...
module opencv_photo...
module opencv_videoio...
module opencv_xphoto...
module opencv_cudacodec...
module opencv_highgui...
module opencv_bioinspired...
module opencv_dnn_objdetect...
module opencv_features2d...
module opencv_line_descriptor...
module opencv_saliency...
module opencv_text...
module opencv_calib3d...
module opencv_ccalib...
module opencv_cudafeatures2d...
module opencv_cudastereo...
module opencv_datasets...
module opencv_mcc...
module opencv_objdetect...
module opencv_rapid...
module opencv_rgbd...
rgbd: CERES support is disabled. Ceres Solver is Required for Posegraph optimization
module opencv_shape...
module opencv_structured_light...
module opencv_video...
module opencv_xfeatures2d...
module opencv_ximgproc...
module opencv_xobjdetect...
module opencv_aruco...
module opencv_bgsegm...
module opencv_cudabgsegm...
module opencv_cudalegacy...
module opencv_cudaobjdetect...
module opencv_dpm...
module opencv_face...
module opencv_optflow...
module opencv_stitching...
module opencv_tracking...
module opencv_cudaoptflow...
module opencv_stereo...
module opencv_superres...
module opencv_videostab...
Processing WORLD modules... DONE
Excluding from source files list: modules/imgproc/src/sumpixels.avx512_skx.cpp
Excluding from source files list: <BUILD>/modules/world/layers/layers_common.avx512_skx.cpp
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1066 (include)

General configuration for OpenCV 4.1.0 =====================================
Version control:               unknown
Extra modules:
Location (extra):            C:/Users/byan982/softwarehere/opencv/opencv_contrib-master/modules
Version control (extra):     unknown
Platform:
Timestamp:                   2021-01-17T23:15:42Z
Host:                        Windows 10.0.16299 AMD64
CMake:                       3.19.2
CMake generator:             Visual Studio 15 2017
CMake build tool:            C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
MSVC:                        1916
CPU/HW features:
Baseline:                    SSE SSE2 SSE3
requested:                 SSE3
Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2
requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (15 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 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?:      YES
C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe  (ver 19.16.27045.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      /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP4   /MD /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      /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP4   /MDd /Zi /Ob0 /Od /RTC1 
C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/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        /MP4    /MD /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        /MP4  /MDd /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 nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/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 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 shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab world xfeatures2d ximgproc xobjdetect xphoto
Disabled:                    -
Disabled by dependency:      -
Unavailable:                 alphamat cnn_3dobj cvv freetype java js julia matlab ovis python2 python2 sfm viz
Applications:                tests perf_tests apps
Documentation:               NO
Non-free algorithms:         NO
Windows RT support:            NO
GUI: 
Win32 UI:                    YES
Media I/O: 
ZLib:                        build (ver 1.2.11)
JPEG:                        build-libjpeg-turbo (ver 2.0.2-62)
WEBP:                        build (ver encoder: 0x020e)
PNG:                         build (ver 1.6.36)
TIFF:                        build (ver 42 - 4.0.10)
JPEG 2000:                   build (ver 1.900.1)
OpenEXR:                     build (ver 1.7.1)
HDR:                         YES
SUNRASTER:                   YES
PXM:                         YES
PFM:                         YES
Video I/O:
DC1394:                      NO
FFMPEG:                      YES (prebuilt binaries)
avcodec:                   YES (58.35.100)
avformat:                  YES (58.20.100)
avutil:                    YES (56.22.100)
swscale:                   YES (5.3.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:                   2019.0.0 Gold [2019.0.0]
at:                   C:/Users/byan982/softwarehere/opencv/opencv/build/3rdparty/ippicv/ippicv_win/icv
Intel IPP IW:                sources (2019.0.0)
at:                C:/Users/byan982/softwarehere/opencv/opencv/build/3rdparty/ippicv/ippicv_win/iw
Lapack:                      NO
Eigen:                       NO
Custom HAL:                  NO
Protobuf:                    build (3.5.1)
NVIDIA CUDA:                   YES (ver 10.1, CUFFT CUBLAS)
NVIDIA GPU arch:             30 35 37 50 52 60 61 70 75
NVIDIA PTX archs:
OpenCL:                        YES (NVD3D11)
Include path:                C:/Users/byan982/softwarehere/opencv/opencv/sources/3rdparty/include/opencl/1.2
Link libraries:              Dynamic load
Python 3:
Interpreter:                 C:/Users/byan982/Anaconda3/python.exe (ver 3.8.5)
Libraries:                   C:/Users/byan982/Anaconda3/libs/python38.lib (ver 3.8.5)
numpy:                       C:/Users/byan982/Anaconda3/lib/site-packages/numpy/core/include (ver 1.19.2)
install path:                C:/Users/byan982/Anaconda3/Lib/site-packages/cv2/python-3.8
Python (for build):            C:/Python27/python.exe
Java:                          
ant:                         NO
JNI:                         C:/Program Files/Amazon Corretto/jdk11.0.3_7/include C:/Program Files/Amazon Corretto/jdk11.0.3_7/include/win32 C:/Program Files/Amazon Corretto/jdk11.0.3_7/include
Java wrappers:               NO
Java tests:                  NO
Install to:                    C:/Users/byan982/softwarehere/opencv/opencv/build/install
-----------------------------------------------------------------
Configuring done

由于这个错误,我将WITH_VTK设置为false并继续在Cmake上生成。我以管理员身份运行Visual Studio并打开OpenCV.sln。我构建ALL_BUILD(配置= Debug x64)和Visual Studio运行相同错误消息的看似无限循环(我停止在5000个错误消息)

24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/private.cuda.hpp(75): warning C4005: 'NPP_VERSION': macro redefinition
24>C:Program FilesNVIDIA GPU Computing ToolkitCUDAv10.1includenpp.h(64): note: see previous definition of 'NPP_VERSION'
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/types.hpp(530): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/types.hpp(532): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/types.hpp(771): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/mat.hpp(257): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/mat.hpp(2681): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/mat.hpp(2682): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/mat.hpp(3547): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/persistence.hpp(454): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/persistence.hpp(457): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core.hpp(112): warning : base class dllexport/dllimport specification differs from that of the derived class
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core.hpp(132): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core.hpp(135): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core.hpp(136): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core.hpp(137): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/utility.hpp(1196): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/utility.hpp(1207): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/cuda.hpp(498): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/cuda.hpp(687): warning : field of class type without a DLL interface used in a class with a DLL interface
24>
24>C:Usersbyan982softwarehereopencvopencvsourcesmodulescoreincludeopencv2/core/cuda.hpp(723): warning : field of class type without a DLL interface used in a class with a DLL interface

我遇到了同样的问题,但不要担心,这些只是警告,说实话,它不会导致无限循环。在我的情况下,它花了1.5小时来完成…另外,确保只选择你的cuda弓。在我的例子中,它是cuda arch 7.5

为了安全起见,请务必检查Numpy版本PIP安装——升级numpy然后继续…

您可以遵循本教程。这真的很有帮助。https://learnopencv.com/how-to-use-opencv-dnn-module-with-nvidia-gpu-on-windows/

按照以上步骤操作,大约需要1.5小时,这样你就可以在平均时间内完成其他任务。

相关内容

  • 没有找到相关文章

最新更新