opencv-rust icon indicating copy to clipboard operation
opencv-rust copied to clipboard

Unable to statically link `OpenCV` without `OpenCL` support on windows.

Open CeNiEi opened this issue 1 year ago • 1 comments

i have been experimenting with the crate, and found that if i disable OpenCL when compiling the static lib files of OpenCV, i am unable to link it correctly to my app. I get the following link error:

          libopencv-3b3b70e538e42495.rlib(8cdb024d75981777-core.o) : error LNK2019: unresolved external symbol "public: bool __cdecl cv::ocl::Kernel::run_(int,unsigned __int64 * const,unsigned __int64 * const,bool,class cv::ocl::Queue const &)" (?run_@Kernel@ocl@cv@@QEAA_NHQEA_K0_NAEBVQueue@23@@Z) referenced in function cv_ocl_Kernel_run__int_size_tX_size_tX_bool_const_QueueR
          libopencv-3b3b70e538e42495.rlib(8cdb024d75981777-core.o) : error LNK2019: unresolved external symbol "public: int __cdecl cv::ocl::PlatformInfo::versionMajor(void)const " (?versionMajor@PlatformInfo@ocl@cv@@QEBAHXZ) referenced in function cv_ocl_PlatformInfo_versionMajor_const
          libopencv-3b3b70e538e42495.rlib(8cdb024d75981777-core.o) : error LNK2019: unresolved external symbol "public: int __cdecl cv::ocl::PlatformInfo::versionMinor(void)const " (?versionMinor@PlatformInfo@ocl@cv@@QEBAHXZ) referenced in function cv_ocl_PlatformInfo_versionMinor_const
          libopencv-3b3b70e538e42495.rlib(8cdb024d75981777-core.o) : error LNK2019: unresolved external symbol "char const * __cdecl cv::ocl::convertTypeStr(int,int,int,char *,unsigned __int64)" (?convertTypeStr@ocl@cv@@YAPEBDHHHPEAD_K@Z) referenced in function cv_ocl_convertTypeStr_int_int_int_charX_size_t
          C:\Users\ryuji\unicorns\cvwin\target\debug\deps\cvwin.exe : fatal error LNK1120: 4 unresolved externals

I am not sure why OpenCL symbols are being generated in the first place, since i set the WITH_OPENCL flag to OFF, when compiling OpenCV? Any clues what might be happening here?

I am not sure, if the output of cargo b -vv would be helpful here, but i am more than happy to provide it, if need be.

CeNiEi avatar Dec 30 '23 21:12 CeNiEi

Do you still have this issue? If so cargo build -vv is always useful to provide the insight into what's happening during binding generation. Please also be sure to use the latest crate version (0.90.0 at the moment of writing)

twistedfall avatar Apr 16 '24 18:04 twistedfall