i am getting this error while making a build for opencv project on mac os (intel chip)

Viewed 165

i am running any code(over xcodes)even "hello world" and i am getting the same error all the time how can i fix this ?????

dyld: Library not loaded: /usr/local/opt/opencv/lib/libopencv_stitching.4.5.dylib
  Referenced from: /Users/khaledzbidat/Library/Developer/Xcode/DerivedData/OpencvCourse_-hhaivjyxxrgltdhgizcoxxkwobzu/Build/Products/Debug/OpencvCourse_
  Reason: no suitable image found.  Did find:
    /usr/local/opt/opencv/lib/libopencv_stitching.4.5.dylib: code signature in (/usr/local/opt/opencv/lib/libopencv_stitching.4.5.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
    /usr/local/lib/libopencv_stitching.4.5.dylib: code signature in (/usr/local/lib/libopencv_stitching.4.5.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
    /usr/local/Cellar/opencv/4.5.4_4/lib/libopencv_stitching.4.5.4.dylib: code signature in (/usr/local/Cellar/opencv/4.5.4_4/lib/libopencv_stitching.4.5.4.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
(lldb) 
1 Answers

It looks like you need to disable library validation for your app to load this library. Apple are getting stricter and stricter about what will and will not run on macOS.

You can do this in the 'Signing and Capabilities' tab of your project settings for your app build target (my app is called VinylStudio, in this example):

enter image description here

Then, hopefully, your library will load and the app will run.

Related