Xcode 7 bitcode_strip error

pzs7602 picture pzs7602 · Aug 18, 2015 · Viewed 7.7k times · Source

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:

/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

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!

Answer

Michael Pogosskiy picture Michael Pogosskiy · Aug 21, 2015

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.

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.

Tested on XCode 7 beta 5