snaggs snaggs - 9 days ago 5
iOS Question

Build iOS project with bitcode enabled causes to error "file.o" does not contain bitcode

I try to build Xcode project through command line:


xcodebuild -project MyAppLib.xcodeproj -sdk iphoneos -target
MyAppTracker -configuration Release clean build
OTHER_LDFLAGS=-fembed-bitcode OTHERCFLAGS=-fembed-bitcode;


but I get error:


Ld build/MyAppLib.build/Release-iphoneos/MyAppTracker.build/Objects-normal/armv7/MyAppTracker
normal armv7
cd /Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib
export IPHONEOS_DEPLOYMENT_TARGET=10.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/snaggs/PostgreSQL/data/pg96:/Users/snaggs/Library/Android/sdk/platform-tools:/Users/snaggs/Library/Android/sdk/tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/clojure:"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch armv7 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk
-L/Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib/build/Release-iphoneos
-F/Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib/build/Release-iphoneos
-filelist /Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib/build/MyAppLib.build/Release-iphoneos/MyAppTracker.build/Objects-normal/armv7/MyAppTracker.LinkFileList
-install_name @rpath/MyAppTracker.framework/MyAppTracker -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=10.0 -dead_strip
-fobjc-arc -fobjc-link-runtime -fembed-bitcode -weak_framework iAd -weak_framework AdSupport -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib/build/MyAppLib.build/Release-iphoneos/MyAppTracker.build/Objects-normal/armv7/MyAppTracker_dependency_info.dat
-o /Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib/build/MyAppLib.build/Release-iphoneos/MyAppTracker.build/Objects-normal/armv7/MyAppTracker
ld: '/Users/snaggs/MyApp/projects/BuildMachine/ios/MyApp_sdk_ios/MyAppLib/build/MyAppLib.build/Release-iphoneos/MyAppTracker.build/Objects-normal/armv7/MyAppTracker_vers.o' does not contain bitcode. You must rebuild it with bitcode enabled
(Xcode setting ENABLE_BITCODE), obtain an updated library from the
vendor, or disable bitcode for this target. for architecture armv7



Do I miss something?

$ xcodebuild -showBuildSettings | grep ENABLE_BITCODE
ENABLE_BITCODE = YES

Answer

The compile flag should be OTHER_CFLAGS and not OTHERCFLAGS.