Description
this is on windows 11 x64 with OpenCV installed statically via vcpkg and using the latest stable rustc (1.87.0).
i can run cargo build --release
successfully, however with cargo build
(i.e. debug build) it always fails because it finds the OpenCV symbols twice: once from the debug lib and once from the release lib, e.g.:
= note: opencv_core4.lib(matrix_expressions.cpp.obj) : error LNK2005: "public: __cdecl cv::MatExpr::MatExpr(class cv::Mat const &)" (??0MatExpr@cv@@QEAA@AEBVMat@1@@Z) already defined in opencv_core4d.lib(opencv_core4d.dll)␍
(there are a ton more of those, see the full output in the gist below)
i'm not sure why it tries to link against the release libs (e.g. opencv_core4.lib
) as well as the debug lib (e.g. opencv_core4d.lib
) during the debug build and i'm not sure whether this is a problem of opencv-rust
or of vcpkg
?
this is not specific to one project, i have this with all projects where i try to use opencv-vcpkg
. i can e.g. reproduce this with my test project
build output (after cargo clean
): https://gist.github.com/rursprung/b1b809520f39341ff7b2e30375db5d2d