天天看点

mac开发-install_name_tool: changing install names or rpaths can't be redone for:

类似错误如下:

error: install_name_tool: changing install names or rpaths can't be redone for: /Users/gensee/Library/Developer/Xcode/DerivedData/Training-emkrlchivsbjssanebsiarnsozuw/Build/Products/Debug/Training.app/Contents/MacOS/Training (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
error: install_name_tool: changing install names or rpaths can't be redone for: /Users/gensee/Library/Developer/Xcode/DerivedData/Training-emkrlchivsbjssanebsiarnsozuw/Build/Products/Debug/Training.app/Contents/MacOS/Training (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
finish install_name_tool target /Users/gensee/Library/Developer/Xcode/DerivedData/Training-emkrlchivsbjssanebsiarnsozuw/Build/Products/Debug/Training.app/Contents/MacOS/Training
Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure

           

原因是我引入了dylib库,需要修改其引用关系,所以使用了 install_name_tool 命令添加了 修改脚本 ,发生了这个报错

解决方法是在other linker中添加

-headerpad_max_install_names

mac开发-install_name_tool: changing install names or rpaths can't be redone for:

-headerpad_max_install_names

作用就是允许开发人员修改dylib的

install_name

为其想要的值,如果不设置,大概率会出现脚本错误。

同时也可能导致 codesign_allocate: can’t allocate code signature data 的错误

参考文章:

https://software.intel.com/zh-cn/node/509396

https://stackoverflow.com/questions/28324785/install-name-tool-cant-use-change-because-larger-updated-load-commands-do-not

继续阅读