I’m trying to follow the documentation, but perhaps I’m missing some steps.
Building 4.5.5 with contrib with VS2022 17.1/17.3 (Also tried 2019) gives me the error
>LINK : fatal error LNK1104: cannot open file 'python310_d.lib'
It’s the only error, and the debug libs are located in %PythonPath%/lib
, as I thought was the standard.
My simple CMakeLists.txt for the project,
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(opencv)
set(OPENCV_EXTRA_MODULES_PATH ../opencv_contrib-4.5.5/modules)
add_subdirectory(opencv-4.5.5)
The cmake build config gives me this warning, but otherwise looks fine:
[cmake] CMake Warning at opencv-4.5.5/cmake/OpenCVGenSetupVars.cmake:54 (message):
[cmake] CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
[cmake] directory
[cmake] Call Stack (most recent call first):
[cmake] opencv-4.5.5/CMakeLists.txt:1035 (include)
Which is the block
if(DEFINED __python_path) # Path to my python dir
if(IS_ABSOLUTE "${__python_path}") # This is the condition that triggers
set(OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG "${__python_path}") # Changes path to "directory"??
message(WARNING "CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install directory")
else()
ocv_path_join(OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG "${OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG}" "${__python_path}")
endif()
else()
if(DEFINED OPENCV_PYTHON3_INSTALL_PATH)
ocv_path_join(OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG "${OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG}" "${OPENCV_PYTHON3_INSTALL_PATH}")
else()
set(OPENCV_PYTHON_DIR_RELATIVE_CMAKECONFIG "python_loader_is_not_installed")
endif()
endif()
I think this may be why my debug build of OpenCV does not work, testing with a sample program using highgui and imgproc.
The Release builds works just fine with no build errors.
Interestingly, a debug builds with opencv source include into the project like the answer to this topic works fine. It’s the same sample program I am testing.
EDIT: My CMakeLists.txt of the sample project:
cmake_minimum_required(VERSION 3.1.0)
project(VehicleComputerVision VERSION 0.1.0)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/archive)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
add_executable(VehicleComputerVision
VehicleComputerVision.cpp
)
target_link_libraries(VehicleComputerVision
PRIVATE
opencv_core
opencv_highgui
opencv_imgproc
)
Config runs fine, build runs fine, but a debug build run simply “fails”:
Loaded ...\VehicleComputerVision\build\bin\Debug\VehicleComputerVision.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'.
Loaded 'C:\Windows\System32\kernel32.dll'.
Loaded 'C:\Windows\System32\KernelBase.dll'.
Loaded 'C:\Windows\System32\msvcp140d.dll'.
The program '[20472] VehicleComputerVision.exe' has exited with code -1073741515 (0xc0000135).