Xcode 7 bitcode_strip 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32071209/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:41:33  来源:igfitidea点击:

Xcode 7 bitcode_strip error

xcodebitcode

提问by pzs7602

My Xcode 7 beta3 project includes some framework compiled by Xcode 6, these frameworks are imported to my project by Embeded Frameworks option in "Build Phase" tab. Because these frameworks does not support bitcode, so the "Enable Bitcode" option turned to NO, when compile the project, Bitcode_strip error occurred:

我的 Xcode 7 beta3 项目包括一些由 Xcode 6 编译的框架,这些框架通过“Build Phase”选项卡中的 Embeded Frameworks 选项导入到我的项目中。因为这些框架不支持bitcode,所以“Enable Bitcode”选项变成NO,编译项目时,出现Bitcode_strip错误:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip /Users/panzhansheng/Desktop/MusicFans_2.0.4_xcode7_autoplay/MusicFans/Frameworks/FLAC.framework/FLAC -r -o /Users/panzhansheng/Library/Developer/Xcode/DerivedData/MusicFans-bxutvotiungdbwfsxloykffnqoqs/Build/Products/Debug-iphoneos/MusicFans.app/FLAC.framework/FLAC /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip: input file must be a linked Mach-O file not an archive: /Users/panzhansheng/Desktop/MusicFans_2.0.4_xcode7_autoplay/MusicFans/Frameworks/FLAC.framework/FLAC (for architecture i386) error: bitcode_strip /Users/panzhansheng/Desktop/MusicFans_2.0.4_xcode7_autoplay/MusicFans/Frameworks/FLAC.framework/FLAC: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip exited with 1

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip /Users/panzhansheng/Desktop/MusicFans_2.0.4_xcode7_autoplay/MusicFans/Frameworks/FLAC.framework/FLAC -r -o /用户/panzhansheng/Library/Developer/Xcode/DerivedData/MusicFans-bxutvotiungdbwfsxloykffnqoqs/Build/Products/Debug-iphoneos/MusicFans.app/FLAC.framework/FLAC /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault. xctoolchain/usr/bin/bitcode_strip:输入文件必须是链接的 Mach-O 文件而不是存档:/Users/panzhansheng/Desktop/MusicFans_2.0.4_xcode7_autoplay/MusicFans/Frameworks/FLAC.framework/FLAC(对于架构 i386)错误: bitcode_strip /Users/panzhansheng/Desktop/MusicFans_2.0.4_xcode7_autoplay/MusicFans/Frameworks/FLAC.framework/FLAC:/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip 以 1 退出

I found that the error happened when Xcode copy my frameworks to my App package and try to strip bitcode from the framework, but these frameworks were compiled by Xcode early version and did not include bitcode at all. How to fix this? Thanks!

我发现当Xcode将我的框架复制到我的App包并尝试从框架中剥离bitcode时发生了错误,但是这些框架是由Xcode早期版本编译的,根本不包含bitcode。如何解决这个问题?谢谢!

回答by Michael Pogosskiy

As I found out, XCode uses bitcode-strip only when enviroment variable STRIP_BITCODE_FROM_COPIED_FILES is set to YES. It seems that it's set to YES by default when enable_bitcode is switched on.

正如我发现的那样,XCode 仅在环境变量 STRIP_BITCODE_FROM_COPIED_FILES 设置为 YES 时才使用 bitcode-strip。似乎在启用 enable_bitcode 时默认设置为 YES。

Adding User-Defined Setting STRIP_BITCODE_FROM_COPIED_FILES=NO to your Target can help you, XCode will not use bitcode-strip, but your app which will use frameworks without bitcode section probably will not work. So it's better to recompile them also using STRIP_BITCODE_FROM_COPIED_FILES=NO if necessary.

将用户定义的设置 STRIP_BITCODE_FROM_COPIED_FILES=NO 添加到您的目标可以帮助您,XCode 不会使用 bitcode-strip,但您的应用程序将使用没有 bitcode 部分的框架可能无法运行。因此,如有必要,最好也使用 STRIP_BITCODE_FROM_COPIED_FILES=NO 重新编译它们。

Tested on XCode 7 beta 5

在 XCode 7 beta 5 上测试

回答by kennydust

following up on M. Pogosskiy's answer, it took me awhile to track down where to put the STRIP_BITCODE_FROM_COPIED_FILES bit setting (not too familiar with these). for reference, here's an illustration:

跟进 M. Pogosskiy 的回答,我花了一段时间才找到放置 STRIP_BITCODE_FROM_COPIED_FILES 位设置的位置(对这些不太熟悉)。作为参考,这是一个插图:

enter image description here

在此处输入图片说明