On macOS, I used to work with dynamic libraries installed via Homebrew with issues.
But with my latest setup:
I start getting code sign problems with the libs that used to work, such as protobuf.
Below is the console output when running a successfully built project:
dyld: Library not loaded: /usr/local/opt/protobuf/lib/libprotobuf.22.dylib
Referenced from: /path/to/myproj/_build/Debug/mam-host
Reason: no suitable image found. Did find:
/usr/local/opt/protobuf/lib/libprotobuf.22.dylib: code signature in (/usr/local/opt/protobuf/lib/libprotobuf.22.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/protobuf/3.11.1/lib/libprotobuf.22.dylib: code signature in (/usr/local/Cellar/protobuf/3.11.1/lib/libprotobuf.22.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.
Program ended with exit code: 9
What should I do?
Should I just
codesign -s "Mac Developer: me" /usr/local/opt/protobuf/lib/libprotobuf.22.dylib
Or do I have to build from source?
P.S. After running codesign command above I got the exact same error.
Finally solved it.
You have two options:
Project Settings > Signing & Capabilities > Hardened Runtime > Runtime Exceptions > Diable Library Validation
Apple Development: Your Name (10-char-ID)
codesign --remove-signature /path/to/theirlib.dylib
codesign -s "Apple Development: Your Name (10-char-ID)" /path/to/theirlib.dylib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With