在macOS上,我曾经使用通过Homebrew安装的有问题的动态库。
但是使用我的最新设置:
- 莫哈韦河10.14.6
- Xcode 11.2.1
我开始遇到以前可以使用的库(例如protobuf)的代码签名问题。
以下是运行成功构建的项目时的控制台输出:
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
我该怎么办?
我应该
codesign -s "Mac Developer: me" /usr/local/opt/protobuf/lib/libprotobuf.22.dylib
还是我必须从源代码构建?
P.S。在运行上面的codesign命令后,我得到了完全相同的错误。