Ask Your Question
0

how to install opencv4 in new xcode 11

asked 2019-11-10 07:48:09 -0600

i installed opencv in xcode and it is building successfully but i'm getting this error

dyld: Library not loaded: /usr/local/opt/opencv/lib/libopencv_gapi.4.1.dylib Referenced from: /Users/vivekvenkatasivaramd/Library/Developer/Xcode/DerivedData/Opencv4F-dvjxczikegzegqgxoicuxvhzgchg/Build/Products/Debug/Opencv4F Reason: no suitable image found. Did find: /usr/local/opt/opencv/lib/libopencv_gapi.4.1.dylib: code signature in (/usr/local/opt/opencv/lib/libopencv_gapi.4.1.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_gapi.4.1.dylib: code signature in (/usr/local/lib/libopencv_gapi.4.1.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.1.2/lib/libopencv_gapi.4.1.2.dylib: code signature in (/usr/local/Cellar/opencv/4.1.2/lib/libopencv_gapi.4.1.2.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)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-05-18 14:29:02 -0600

In case some unfortunate soul stumbles upon this thread in the future, be content that I have found a solution.

The issue is with code signing, so to solve it, you can sign the code. Use the following command in Terminal:

codesign -f -s "Your Email" /usr/local/opt/opencv/lib/libopencv_gapi.4.3.dylib

Don't just copy it though, put in your email and make sure the library and version number is correct. Use the file path Xcode spits out at you in the error message, which for OP was /usr/local/Cellar/opencv/4.1.2/lib/libopencv_gapi.4.1.2.dylib. Use the command for each of the file paths Xcode is complaining about.

If, when you use that, codesign hits you with that no identity found, do not despair. At that point, I gave up doing it the pretty way, and just disabled library validation in Xcode. This can be done by going to your development target in Xcode, and under 'Signing and Capabilities' and 'All', in the section 'Hardened runtime', checking the box named 'Disable Library Validation'. Apple likes to move things around, so if you can't find the setting there, look around for a bit or Google it.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-11-10 07:48:09 -0600

Seen: 1,165 times

Last updated: Nov 10 '19