Mac开发-codesign_allocate: can't allocate code signature data
程序员文章站
2023-12-28 10:39:28
...
参考链接 https://github.com/xamarin/xamarin-macios/issues/5243
网上说查看 /usr/bin/codesign_allocate
并替换,但这个报错本来是正常的,突然就出现了。很气怪,有时候就改了一部分代码就出现。
后面根据上面链接,发现是install_name_tool
的问题,这个指令用户我们设置动态库的引用问题,但同时也会导致codesign_allocate: can't allocate code signature data
例如如下:
error: install_name_tool: can't open file: /Users/gensee/Library/Developer/Xcode/DerivedData/Webcast-fdypojugksmojmbaqvqtwgrphsmc/Build/Products/Debug/Webcast.app/Contents/MacOS/libRtRoutineOSX.dylib (No such file or directory)
finish install_name_tool target /Users/gensee/Library/Developer/Xcode/DerivedData/Webcast-fdypojugksmojmbaqvqtwgrphsmc/Build/Products/Debug/Webcast.app/Contents/MacOS/Webcast
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
codesign_allocate: can't allocate code signature data for: (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked using a larger -headerpad value)
和类似下面的
atal error: codesign_allocate: can't allocate code signature data for:
/...../X.app/Contents/Frameworks/libtiff.5.dylib
(for architecture x86_64)
because larger updated load commands do not fit (the program must be relinked using a larger -headerpad value)
/..../Products/Debug/X.app:
the codesign_allocate helper tool cannot be found or used
In subcomponent: /..../Products/Debug/X.app/Contents/Frameworks/libtiff.5.dylib
这里我的问题是:
去掉了重复和不必要的install_name_tool
,或者将其放在脚本中执行,这样会在code sign之后,偶尔出现的codesign_allocate
彻底解决了,不会再出现。如果你也遇到,请考虑是否install_name_tool
重复操作过多的问题,避免不必要的install_name_tool