Skip to content

Unable to build opencv  #21299

@LaurentBerger

Description

@LaurentBerger
  • OpenCV => 4.5.5
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2017
Detailed description
  opencv_highgui_main.cpp
     CrÚation de la bibliothÞque G:/Lib/build/opencv/lib/Release/opencv_highgui455.lib et de l'objet G:/Lib/build/opencv/lib/Release/opencv_highgui455.exp
window_w32.obj : error LNK2019: symbole externe non rÚsolu __imp_wglCreateContext rÚfÚrencÚ dans la fonction "void __cdecl `anonymous namespace'::createGlContext(struct HWND__ *,struct HDC__ * &,struct HGLRC__ * &,bool &)" (?createGlContext@?A0x6a3b5ada@@YAXPEAUHWND__@@AEAPEAUHDC__@@AEAPEAUHGLRC__@@AEA_N@Z) [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]
window_w32.obj : error LNK2019: symbole externe non rÚsolu __imp_wglDeleteContext rÚfÚrencÚ dans la fonction "void __cdecl icvRemoveWindow(class std::shared_ptr<struct CvWindow> const &)" (?icvRemoveWindow@@YAXAEBV?$shared_ptr@UCvWindow@@@std@@@Z) [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]
window_w32.obj : error LNK2019: symbole externe non rÚsolu __imp_wglGetProcAddress rÚfÚrencÚ dans la fonction "double __cdecl getPropVsync_(struct CvWindow &)" (?getPropVsync_@@YANAEAUCvWindow@@@Z) [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]
window_w32.obj : error LNK2019: symbole externe non rÚsolu __imp_wglMakeCurrent rÚfÚrencÚ dans la fonction "__int64 __cdecl HighGUIProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?HighGUIProc@@YA_JPEAUHWND__@@I_K_J@Z) [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]
window_w32.obj : error LNK2019: symbole externe non rÚsolu __imp_glClear rÚfÚrencÚ dans la fonction "__int64 __cdecl HighGUIProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?HighGUIProc@@YA_JPEAUHWND__@@I_K_J@Z) [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]
window_w32.obj : error LNK2019: symbole externe non rÚsolu __imp_glViewport rÚfÚrencÚ dans la fonction "__int64 __cdecl HighGUIProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?HighGUIProc@@YA_JPEAUHWND__@@I_K_J@Z) [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]
G:\Lib\build\opencv\bin\Release\opencv_highgui455.dll : fatal error LNK1120: 6 externes non rÚsolus [G:\Lib\build\opencv\modules\highgui\opencv_highgui.vcxproj]

My configuration 👍

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- Detected processor: AMD64
-- Found ZLIB: optimized;G:/lib/install/zlib/lib/zlibstatic.lib;debug;G:/lib/install/zlib/lib/zlibstaticd.lib (found suitable version "1.2.11", minimum required is "1.2.3")
-- libjpeg-turbo: VERSION = 2.1.2, BUILD = opencv-4.5.5-pre-libjpeg-turbo
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
-- OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.5.5-pre-openjp2-2.4.0
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
-- Found ZLIB: optimized;G:/lib/install/zlib/lib/zlibstatic.lib;debug;G:/lib/install/zlib/lib/zlibstaticd.lib (found version "1.2.11")
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: G:/Lib/build/opencv/3rdparty/ippicv/ippicv_win/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: G:/Lib/build/opencv/3rdparty/ippicv/ippicv_win/iw
-- 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)
-- LAPACK requires BLAS
-- A library with LAPACK API not found. Please specify library location.
-- Found VTK 9.0.20210122
-- 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.
-- Found installed version of gflags: G:/lib/install/gflags/lib/cmake/gflags
-- Detected gflags version: 2.2.1
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (Gflags)
  does not match the name of the calling package (gflags).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  G:/Lib/install/ceres-solver/CMake/FindGflags.cmake:581 (find_package_handle_standard_args)
  G:/Lib/install/ceres-solver/CMake/CeresConfig.cmake:256 (find_package)
  G:/Lib/opencv_contrib/modules/sfm/CMakeLists.txt:7 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Tesseract:   YES (ver unknown)
-- Allocator metrics storage type: 'long long'
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': G:/Lib/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.rvv.cpp
-- highgui: using builtin backend: WIN32UI
-- 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.
-- Found installed version of gflags: G:/lib/install/gflags/lib/cmake/gflags
-- Detected gflags version: 2.2.1
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (Gflags)
  does not match the name of the calling package (gflags).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  G:/Lib/install/ceres-solver/CMake/FindGflags.cmake:581 (find_package_handle_standard_args)
  G:/Lib/install/ceres-solver/CMake/CeresConfig.cmake:256 (find_package)
  G:/Lib/opencv_contrib/modules/sfm/CMakeLists.txt:7 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found 'misc' Python modules from G:/Lib/opencv/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from G:/Lib/opencv/modules/core/misc/python/package
-- Found 'gapi' Python modules from G:/Lib/opencv/modules/gapi/misc/python/package
-- Found 'misc' Python modules from G:/Lib/opencv/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from G:/Lib/opencv/modules/core/misc/python/package
-- Found 'gapi' Python modules from G:/Lib/opencv/modules/gapi/misc/python/package
-- SYCL/OpenCL samples are skipped: SYCL SDK is required
--    - check configuration of SYCL_DIR/SYCL_ROOT/CMAKE_MODULE_PATH
--    - ensure that right compiler is selected from SYCL SDK (e.g, clang++): CMAKE_CXX_COMPILER=C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Registered 'check_pylint' target: using C:/Users/Laurent/AppData/Roaming/Python/Python39/Scripts/pylint.exe (ver: 2.11.1), checks: 190
-- Registered 'check_flake8' target: using C:/Users/Laurent/AppData/Roaming/Python/Python39/Scripts/flake8.exe (ver: 4.0.1)
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:1035 (include)


--
-- General configuration for OpenCV 4.5.5-pre =====================================
--   Version control:               4.5.2-1007-g374cc4183e
--
--   Extra modules:
--     Location (extra):            G:/Lib/opencv_contrib/modules
--     Version control (extra):     4.5.1-258-gf31d2034
--
--   Platform:
--     Timestamp:                   2021-12-21T10:45:51Z
--     Host:                        Windows 10.0.19043 AMD64
--     CMake:                       3.18.4
--     CMake generator:             Visual Studio 15 2017 Win64
--     CMake build tool:            C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe
--     MSVC:                        1916
--     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 (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (33 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 (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/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  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MD /O2 /OEBUG
--     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:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MDd /Zi / /RTC1
--     C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/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:precise     /MP   /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  /fp:precise     /MP /MDd /Zi /Ob0 /Od /RTC1
--     Linker flags (Release):      /machine:x64  /INCREMENTAL:NO
--     Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 alphamat aruco barcode bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor objdetect optflow phase_unwrapping photo plot python3 quality rapid reg saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    rgbd world
--     Disabled by dependency:      -
--     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java julia matlab ovis python2
--     Applications:                tests perf_tests examples apps
--     Documentation:               doxygen python
--     Non-free algorithms:         YES
--
--   Windows RT support:            NO
--
--   GUI:                           WIN32UI
--     Win32 UI:                    YES
--     OpenGL support:              YES (opengl32 glu32)
--     VTK support:                 YES (ver 9.0.20210122)
--
--   Media I/O:
--     ZLib:                        optimized G:/lib/install/zlib/lib/zlibstatic.lib debug G:/lib/install/zlib/lib/zlibstaticd.lib (ver 1.2.11)
--     JPEG:                        build-libjpeg-turbo (ver 2.1.2-62)
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         optimized G:/lib/install/libpng/lib/libpng16_static.lib debug G:/lib/install/libpng/lib/libpng16_staticd.lib (ver 1.6.36)
--     TIFF:                        build (ver 42 - 4.2.0)
--     JPEG 2000:                   build (ver 2.4.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
--
--   Other third-party libraries:
--     Intel IPP:                   2020.0.0 Gold [2020.0.0]
--            at:                   G:/Lib/build/opencv/3rdparty/ippicv/ippicv_win/icv
--     Intel IPP IW:                sources (2020.0.0)
--               at:                G:/Lib/build/opencv/3rdparty/ippicv/ippicv_win/iw
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.3.90)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.19.1)
--
--   OpenCL:                        YES (NVD3D11)
--     Include path:                G:/Lib/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python 3:
--     Interpreter:                 C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python39_64/python.exe (ver 3.9.5)
--     Libraries:                   C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python39_64/libs/python39.lib (ver 3.9.5)
--     numpy:                       C:/Users/Laurent/AppData/Roaming/Python/Python39/site-packages/numpy/core/include (ver 1.21.4)
--     install path:                C:/Users/Laurent/AppData/Roaming/Python/Python39/Scripts/lib/site-packages/cv2/python-3.9
--
--   Python (for build):            C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python39_64/python.exe
--
--   Java:
--     ant:                         NO
--     JNI:                         C:/Program Files/Java/jdk1.8.0_152/include C:/Program Files/Java/jdk1.8.0_152/include/win32 C:/Program Files/Java/jdk1.8.0_152/include
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    G:/Lib/install/opencv
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done

How to solve ?
Add a line in : opencv/cmake/OpenCVFindLibsGUI.cmake

# --- OpenGl ---
ocv_clear_vars(HAVE_OPENGL HAVE_QT_OPENGL)
if(WITH_OPENGL)
  if(WITH_WIN32UI OR (HAVE_QT AND QT_QTOPENGL_FOUND) OR HAVE_GTKGLEXT)
    find_package (OpenGL QUIET)
    if(OPENGL_FOUND)
      set(HAVE_OPENGL TRUE)
      if(QT_QTOPENGL_FOUND)
        set(HAVE_QT_OPENGL TRUE)
      else()
### NEWLINE
      list(APPEND OPENCV_LINKER_LIBS ${OPENGL_LIBRARIES}) 
### That's all
        ocv_include_directories(${OPENGL_INCLUDE_DIR})
      endif()
    endif()
  endif()
endif(WITH_OPENGL)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions