-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Description
System Information
OpenCV version: 4.10.0
Operating System / Platform: macOS 14.5
Compiler & compiler version: Apple clang version 15.0.0 (clang-1500.3.9.4)
Detailed description
Building OpenCV as static libraries, linking an executable to the OpenCV libraries includes a dependency on libOrbbecSDK.1.9.dylib, which is downloaded by the OpenCV CMake scripts as a binary from https://github.com/orbbec/OrbbecSDK/archive/refs/tags/v1.9.4/v1.9.4.tar.gz
This leads to a runtime error:
dyld[91496]: Library not loaded: @loader_path/libOrbbecSDK.1.9.dylib
Referenced from: <04F3B988-DAA1-3E03-9647-9AF524798169> $EXECUTABLE_PATH/$EXECUTABLE_NAME
Reason: tried: '$EXECUTABLE_PATH//libOrbbecSDK.1.9.dylib' (no such file)
(Actual paths in the error message replaced with $EXECUTABLE_PATH and $EXECUTABLE_NAME)
The annoyance of the error aside, linking to a random third-party closed-source binary by default seems to be a really bad idea to me. The PR which added this forced default on macOS appears to be this one, specifically see modules/videoio/cmake/detect_obsensor.cmake
Removing the lines which force the use of this SDK on by default doesn't cause any obvious problems with video camera input.
Steps to reproduce
On macOS, build OpenCV 4.10.0 from source:
cmake -DBUILD_SHARED_LIBS=OFF -GNinja .. && ninja install
Build repro exe:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
project(orbbec_repro)
find_package(OpenCV REQUIRED)
add_executable(orbbec_repro main.cc)
target_link_libraries(orbbec_repro opencv_videoio)
main.cc:
int main(int argc, const char** argv) { return 0; }
Build and run:
% cmake .. -GNinja && ninja && ./orbbec_repro
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "4.10.0")
-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/andy/code/opencv_orbbec_repro/build-ninja
[1/1] Linking CXX executable orbbec_repro
ld: warning: ignoring duplicate libraries: '-ldl', '-lm'
dyld[49545]: Library not loaded: @loader_path/libOrbbecSDK.1.9.dylib
Referenced from: <C20AE4A9-C644-34A1-BE0C-0790F2107CD2> /Users/andy/code/opencv_orbbec_repro/build-ninja/orbbec_repro
Reason: tried: '/Users/andy/code/opencv_orbbec_repro/build-ninja/libOrbbecSDK.1.9.dylib' (no such file)
zsh: abort ./orbbec_repro
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)