-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Can't find zlib1.dll/zlibd1.dll with own built opencv installation #17051
Description
System information (version)
- OpenCV => 4.3.0
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
Detailed description
I would like to debug into OpenCV's C++ source code, to see function / algorithm implementation details. Say, I'm interested in how cv::imread( ) implemtented, by using the prebuilt OpenCV Windows package, it just complains "can't find loadsave.cpp". Thus I turn to built OpenCV from source with VS2017.
After building & installation of my customized version, I write a simple code as executable target, aims to providing break point entry, for further debugging into OpenCV source. However, when running, it complains "zlib1.dll" can't find (release mode), "zlibd1.dll" can't find (debug mode). Wired. Note that I've prepend "/path/to/installed/opencv/vc15/x64/bin" and re-opened Visual Studio.
Steps to reproduce
- Git clone OpenCV4.3's source code
cd d:/work/
git clone https://github.com/opencv/opencv
cd opencv
git checkout -b 4.3.0 4.3.0
- Compile OpenCV with:
@echo off
set BUILD_DIR=vs2017-x64
::set OpenBLAS_HOME=D:/lib/openblas/0.2.14-Win64-int64
if not exist %BUILD_DIR% md %BUILD_DIR%
cd %BUILD_DIR%
cmake -G "Visual Studio 15 2017 Win64" ^
-D CMAKE_BUILD_TYPE=Debug ^
-D CMAKE_INSTALL_PREFIX=%cd%/install ^
-D WITH_CUDA=OFF ^
-D WITH_VTK=OFF ^
-D WITH_MATLAB=OFF ^
-D BUILD_DOCS=OFF ^
-D BUILD_opencv_python3=OFF ^
-D BUILD_opencv_python2=OFF ^
-D WITH_FFMPEG=OFF ^
-D BUILD_JAVA=OFF ^
-D WITH_PROTOBUF=OFF ^
-D WITH_IPP=OFF ^
-D CV_DISABLE_OPTIMIZATION=ON ^
-D BUILD_TESTS=OFF ^
-D BUILD_PERF_TESTS=OFF ^
-D WITH_OPENCL=OFF ^
-D BUILD_LIST=core,imgcodecs,highgui ^
../..
cd ..
pauseThe opencv_version_win32.exe generates:
General configuration for OpenCV 4.3.0 =====================================
Version control: 4.3.0
Platform:
Timestamp: 2020-04-13T15:19:24Z
Host: Windows 10.0.18362 AMD64
CMake: 3.17.1
CMake generator: Visual Studio 15 2017 Win64
CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe
MSVC: 1916
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe (ver 19.16.27038.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 /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:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/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 /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: core highgui imgcodecs imgproc
Disabled: world
Disabled by dependency: calib3d features2d flann gapi java_bindings_generator ml objdetect photo python_bindings_generator python_tests stitching video videoio
Unavailable: dnn java js python2 python3 ts
Applications: 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.4-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.0.10)
JPEG 2000: build Jasper (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
GStreamer: NO
DirectShow: YES
Media Foundation: YES
DXVA: YES
Parallel framework: Concurrency
Trace: YES (with Intel ITT)
Other third-party libraries:
Custom HAL: NO
Python (for build): D:/soft/Miniconda3/python.exe
Install to: D:/work/opencv-4.3.0/build/vs2017-x64/install
-----------------------------------------------------------------
OpenCL is disabled
OpenCV's HW features list:
ID= 1 (MMX) -> ON
ID= 2 (SSE) -> ON
ID= 3 (SSE2) -> ON
ID= 4 (SSE3) -> ON
ID= 5 (SSSE3) -> ON
ID= 6 (SSE4.1) -> ON
ID= 7 (SSE4.2) -> ON
ID= 8 (POPCNT) -> ON
ID= 9 (FP16) -> ON
ID= 10 (AVX) -> ON
ID= 11 (AVX2) -> ON
ID= 12 (FMA3) -> ON
Total available: 12
Parallel framework: ms-concurrency (nthreads=6)
And opencv_version_win32d.exe generates:
General configuration for OpenCV 4.3.0 =====================================
Version control: 4.3.0
Platform:
Timestamp: 2020-04-13T15:19:24Z
Host: Windows 10.0.18362 AMD64
CMake: 3.17.1
CMake generator: Visual Studio 15 2017 Win64
CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe
MSVC: 1916
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe (ver 19.16.27038.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 /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:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/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 /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: core highgui imgcodecs imgproc
Disabled: world
Disabled by dependency: calib3d features2d flann gapi java_bindings_generator ml objdetect photo python_bindings_generator python_tests stitching video videoio
Unavailable: dnn java js python2 python3 ts
Applications: 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.4-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.0.10)
JPEG 2000: build Jasper (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
GStreamer: NO
DirectShow: YES
Media Foundation: YES
DXVA: YES
Parallel framework: Concurrency
Trace: YES (with Intel ITT)
Other third-party libraries:
Custom HAL: NO
Python (for build): D:/soft/Miniconda3/python.exe
Install to: D:/work/opencv-4.3.0/build/vs2017-x64/install
-----------------------------------------------------------------
OpenCL is disabled
OpenCV's HW features list:
ID= 1 (MMX) -> ON
ID= 2 (SSE) -> ON
ID= 3 (SSE2) -> ON
ID= 4 (SSE3) -> ON
ID= 5 (SSSE3) -> ON
ID= 6 (SSE4.1) -> ON
ID= 7 (SSE4.2) -> ON
ID= 8 (POPCNT) -> ON
ID= 9 (FP16) -> ON
ID= 10 (AVX) -> ON
ID= 11 (AVX2) -> ON
ID= 12 (FMA3) -> ON
Total available: 12
Parallel framework: ms-concurrency (nthreads=6)
- Write a simple CMake driven C++ project.
CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(ocv_demo)
find_package(OpenCV REQUIRED)
add_executable(run src/main.cpp)
target_link_libraries(run ${OpenCV_LIBS})src/main.cpp
#include <opencv2/opencv.hpp>
int main() {
cv::Mat im = cv::Mat::ones(100, 100, CV_64FC3);
im = im * 0.73 * 255;
cv::imwrite("res-cpp.bmp", im);
return 0;
}generate Visual Studio solution by:
cmake ../.. -G "Visual Studio 15 2017 Win64" -DOpenCV_DIR="D:/work/opencv-4.3.0/build/vs2017-x64/install"
- Run the new generated visual studio's
runtarget.
Just run it, and will get message like "can't find zlib1.dll" (I'm not English language version of VS2017 thus it maybe not exactly what it says).
- What's your PATH?
C:\Users\zz>echo %PATH%
D:\soft\Miniconda3\condabin;D:\work\opencv-4.3.0\build\vs2017-x64\install\x64\vc15\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;D:\soft\Android\sdk\platform-tools;d:\soft\TDM-GCC-64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;D:\soft\git\cmd;d:\soft\VSCode_Insiders\bin;D:\soft\cmake-3.17.1\bin;D:\soft\ninja;d:\soft\WinMerge;D:\soft\TortoiseGit\bin;D:\soft\Vim\vim81;D:\soft\ffmpeg\bin;C:\Users\zz\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;d:\soft\LLVM\bin;D:\soft\Cppcheck;D:\lib\protobuf\3.5.2\x64\vc15\bin;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;D:\soft\git\usr\bin;D:\soft\Notepad++;D:\soft\opencv-1.0\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0\;D:\soft\Miniconda3;D:\soft\Miniconda3\Scripts;D:\soft\Miniconda3\Library\bin;C:\Users\zz\AppData\Local\Microsoft\WindowsApps;Note
I know there's a workaround
find the missing dll which is complained by VS2017, put it into installation's
bindirectory.
However, I don't feel it convenient and some other people will also meet that problem, thus I put the issue here.