Closed Kazurin-775 closed 2 months ago
Can you please provide a full output of cargo build -vv
after doing a cargo clean
? It should contain the necessary information to help debug this issue. -vv
is important as it adds a lot of auxiliary debug logging.
Can you please provide a full output of
cargo build -vv
after doing acargo clean
?
OK, here you go: clean-build.log
The problem is that vcpkg helper copies release versions of the OpenCV but links to the debug ones. This can happen because of the fact that actual discovery is done with cmake without using vcpkg. Can you please try building with the following environment variable:
OPENCV_DISABLE_PROBES=vcpkg_cmake
OPENCV_DISABLE_PROBES=vcpkg_cmake
This seems to be a working solution (no more link errors, and produces a working executable file)! Thank you!
Can you please also share the full build log of this successful build?
Can you please also share the full build log of this successful build?
OK, here it is: clean-build-without-cmake.log
set OPENCV_DISABLE_PROBES=vcpkg_cmake
before running
cargo clean
cargo build
won't work.
Any help?
@3togo I'm sorry, but I'm afraid that your issue is not related to mine. Your build log states that:
[opencv 0.78.2] === Probing OpenCV library using vcpkg
[opencv 0.78.2] === Can't probe using: vcpkg, continuing with other methods because: Could not find library in Vcpkg tree package opencv4 is not installed for vcpkg triplet x64-windows-static-md, Could not find library in Vcpkg tree package opencv3 is not installed for vcpkg triplet x64-windows-static-md
Therefore, you may have forgotten to install opencv4:x64-windows-static-md
, or you may have to set VCPKGRS_DYNAMIC = 1
if you prefer to link against the DLL version, as stated in this project's README.md.
@Kazurin-775 ,
Setting VCPKGRS_DYNAMIC = 1 can fix the problem.
many thanks.
@3togo I'm sorry, but I'm afraid that your issue is not related to mine. Your build log states that:
[opencv 0.78.2] === Probing OpenCV library using vcpkg [opencv 0.78.2] === Can't probe using: vcpkg, continuing with other methods because: Could not find library in Vcpkg tree package opencv4 is not installed for vcpkg triplet x64-windows-static-md, Could not find library in Vcpkg tree package opencv3 is not installed for vcpkg triplet x64-windows-static-md
Therefore, you may have forgotten to install
opencv4:x64-windows-static-md
, or you may have to setVCPKGRS_DYNAMIC = 1
if you prefer to link against the DLL version, as stated in this project's README.md.
@Kazurin-775 This task is quite old, I'm going to close it in the hope that you don't have this problem any more, but feel free to reopen in case it's not true.
Yes, I haven't been using OpenCV for quite a long time... :(
Just took some time to play around, it looks like that with $env:VCPKGRS_DYNAMIC = '1'
the build process is working perfectly now. Without $env:VCPKGRS_DYNAMIC = '1'
I encountered the same problem as #340 , and I have yet no idea how to fix it. But anyway, this one should be different from what I reported 2 years ago.
Thank you for your hard work :)
Well, we managed to solve it in that issue, so I suppose keep googling the symbol and add the dependencies as mentioned in that issue :)
Yeah, I got that working for me too. The correct setting for me is:
$env:OPENCV_LINK_LIBS = '+user32,gdi32,comdlg32'
(I suppose that this value could be set as the default, as these 3 libraries seem to be the hard dependencies of OpenCV?)
Probably worth adding to the troubleshooting at least, thank you for checking!
llvm-config.exe
compiled by handPhenomenon: the debug build of a fresh (but non-empty) project fails with the following linker error (full build.log):
But the release build works like a charm, and can produce a working executable file. Setting
$env:VCPKGRS_DYNAMIC = 1
does not solve the problem for me, and will give the same error as above.Later I managed to make the linking process work by manually linking against the release build of the library (with
.cargo/config.toml
):However, the output executable file suffers from DLL version inconsistency, as it depends on both
opencv_***.dll
andopencv_***d.dll
, and will fail miserably with a C++ assertion error even if both DLLs are provided.What's more, the DLLs copied by vcpkg are wrongly placed in
my-fancy-project\target\debug\build\opencv-f4083f72defdfbbf\out
instead ofmy-fancy-project\target\debug
, and the release builds of the DLLs are copied instead of debug builds, causing a "DLL not found" error at program startup.Is there any way to get the debug build working?