Closed onthegrid007 closed 3 days ago
@onthegrid007 seems like Clang on Windows doesn't support DELAYLOAD functionality
Fastest would be to use MSVC for now. Or tweaks done to XLink dependency
@themarpe I have fooled around looking for where the flag is inserted but can't find it out... any tricks?
The flag comes from XLink - its the win32 path for loading libusb
Added a fix to a forked repo, it works for the first error but a new error has occurred where it doesn't seem to link with opencv itself, I assume a missing lib link flag or something...
[3/4] Linking CXX shared library vendor\depthai-core\depthai-opencvd.dll
FAILED: vendor/depthai-core/depthai-opencvd.dll vendor/depthai-core/depthai-opencvd.lib
C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C ""C:\Program Files\CMake\bin\cmake.exe" -E __create_def C:\gitlibs\FRCDepth\build\vendor\depthai-core\CMakeFiles\depthai-opencv.dir\.\exports.def C:\gitlibs\FRCDepth\build\vendor\depthai-core\CMakeFiles\depthai-opencv.dir\.\exports.def.objs --nm="C:\Program Files\LLVM\bin\llvm-nm.exe" && cd C:\gitlibs\FRCDepth\build" && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -nostartfiles -nostdlib -O0 -g -Xclang -gcodeview -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -fuse-ld=lld-link -Xlinker /DEF:vendor\depthai-core\CMakeFiles\depthai-opencv.dir\.\exports.def -shared -o vendor\depthai-core\depthai-opencvd.dll -Xlinker /MANIFEST:EMBED -Xlinker /implib:vendor\depthai-core\depthai-opencvd.lib -Xlinker /pdb:vendor\depthai-core\depthai-opencvd.pdb -Xlinker /version:0.0 vendor/depthai-core/CMakeFiles/depthai-opencv.dir/src/opencv/ImgFrame.cpp.obj C:/gitlibs/opencv/build-clang/lib/opencv_imgproc4100.lib vendor/depthai-core/depthai-cored.lib C:/gitlibs/opencv/build-clang/lib/opencv_core4100.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
lld-link: error: undefined symbol: void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &, class cv::debug_build_guard::_OutputArray const &, int, int)
>>> referenced by C:\gitlibs\FRCDepth\vendor\depthai-core\src\opencv\ImgFrame.cpp:104
>>> vendor/depthai-core/CMakeFiles/depthai-opencv.dir/src/opencv/ImgFrame.cpp.obj:(public: class cv::Mat __cdecl dai::ImgFrame::getCvFrame(void))
>>> referenced by C:\gitlibs\FRCDepth\vendor\depthai-core\src\opencv\ImgFrame.cpp:132
>>> vendor/depthai-core/CMakeFiles/depthai-opencv.dir/src/opencv/ImgFrame.cpp.obj:(public: class cv::Mat __cdecl dai::ImgFrame::getCvFrame(void))
>>> referenced by C:\gitlibs\FRCDepth\vendor\depthai-core\src\opencv\ImgFrame.cpp:136
>>> vendor/depthai-core/CMakeFiles/depthai-opencv.dir/src/opencv/ImgFrame.cpp.obj:(public: class cv::Mat __cdecl dai::ImgFrame::getCvFrame(void))
>>> referenced 1 more times
lld-link: error: undefined symbol: void __cdecl cv::merge(class cv::debug_build_guard::_InputArray const &, class cv::debug_build_guard::_OutputArray const &)
>>> referenced by C:\gitlibs\FRCDepth\vendor\depthai-core\src\opencv\ImgFrame.cpp:118
>>> vendor/depthai-core/CMakeFiles/depthai-opencv.dir/src/opencv/ImgFrame.cpp.obj:(public: class cv::Mat __cdecl dai::ImgFrame::getCvFrame(void))
>>> referenced by C:\gitlibs\FRCDepth\vendor\depthai-core\src\opencv\ImgFrame.cpp:128
>>> vendor/depthai-core/CMakeFiles/depthai-opencv.dir/src/opencv/ImgFrame.cpp.obj:(public: class cv::Mat __cdecl dai::ImgFrame::getCvFrame(void))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
@themarpe It seems to be linking with imgproc and core properly but the actual function calls aren't being recognized, any thoughts?
@onthegrid007 Hmm, first thing to check is what OpenCV was being compiled against (eg which -I/include/dirs
are part of the compilation line that compiles src/opencv/ImgFrame.cpp
), and then which was it linked against.
And the second thing to check is the "release v debug" build that the errors indicate. Perhaps OpenCV builds some of the API differently in these two cases. So make sure in same way as above you are compiling for headers of same release/debug build/prebuilt
I got it to compile in Release build mode bud had to make some dirty fixed to my cmake file and some abs paths to library files... Everything is included on the $PATH so the fact it is finding the dlls but not the lib files is interesting
Could it be because I build OpenCV in release vs debug?
It could yup - try building the core for same as OpenCV is
Is there something I am doing wrong?