I am experiencing issues building DepthAI core C++ library with OpenCV support enabled on my Ubuntu 22.04 system with CUDA-enabled OpenCV 4.13.0 installed from source.
Despite successful detection of OpenCV in cmake logs and correct linking of OpenCV libs in the DepthAI shared library, compiling any DepthAI calls that require OpenCV support - ie. ImgFrame::getCvFrame - result in static assertion errors indicating "Library not configured with OpenCV support".
Environment:
Steps to Reproduce:
Clean install OpenCV from source with CUDA, installed to /usr/local
Clone DepthAI core, submodules update
Configure DepthAI with cmake: -D OpenCV_DIR=/usr/local/lib/cmake/opencv4 -D DEPTHAI_OPENCV_SUPPORT=ON
Build and install DepthAI core
Attempt to build OpenFrameworks project invoking DepthAI OpenCV APIs
Observed Behavior:
CMake logs show DEPTHAI_OPENCV_SUPPORT enabled
ldd on libdepthai-core.so confirms linkage with OpenCV libraries
Compiler errors persist when calling OpenCV-dependent APIs, with static assertion: Library not configured with OpenCV support
Logs:
I prepared all the logs to attach to this ticket, but I'm not allowed to upload any. "Uploading files of this type is not allowed." I've tried numerous extensions and they all fail. If you need access to certain log files, please ask and provide a method of transfer. You can find the cmake config flags I've used to build opencv and depthai below.
opencv cmake -D flags:
cmake -D'CMAKE_BUILD_TYPE=Release' \
-D'CMAKE_INSTALL_PREFIX=/usr/local' \
-D'OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules' \
-D'WITH_CUDA=ON' \
-D'WITH_CUDNN=ON' \
-D'OPENCV_DNN_CUDA=ON' \
-D'CUDA_ARCH_BIN=8.9' \
-D'CUDA_HOST_COMPILER=/usr/bin/g++' \
-D'OPENCV_GENERATE_PKGCONFIG=ON' \
-D'CPU_BASELINE=SSE3' \
-D'CMAKE_VERBOSE_MAKEFILE=ON' \
-D'BUILD_opencv_python3=ON' \
-D'CURL_INCLUDE_DIR=ls -l /usr/include/x86_64-linux-gnu/curl' \
-D'CURL_LIBRARY=/usr/lib/x86_64-linux-gnu/libcurl.so' \
-D'BUILD_EXAMPLES=ON' ..
depthai cmake -D flags:
cmake -B build -S . \
-D'BUILD_SHARED_LIBS=ON' \
-D'CMAKE_INSTALL_PREFIX=/usr/local/' \c
-D'OpenCV_DIR=/usr/local/lib/cmake/opencv4' \
-D'CMAKE_VERBOSE_MAKEFILE=ON' \
-D'DEPTHAI_OPENCV_SUPPORT=ON' ..
Please advise on resolving this issue or inquire about additional information if needed.
Thank you in advance.