iOS build failed with `ld: bitcode bundle could not be generated`
Solution 1
I had a similar problem. My solution was to goto Xcode-Product-Scheme-edit scheme- make sure that the archive schemas build configuration is set to Release. Mine was for some reason set to debug.
Solution 2
I think the solution is opposite you need to disable bitcode because Flutter doesn't use it. You can do it by editing your Podfile to something like this:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['ENABLE_BITCODE] = 'NO'
end
end
end
you can find more details here https://github.com/flutter/flutter/issues/78589
dhshtmdgml
Updated on January 03, 2023Comments
-
dhshtmdgml over 1 year
I have following error when building iOS with CodeMagic.
Running Xcode build... Xcode archive done. 14.3s Failed to build iOS app Error output from Xcode build: ↳ ** ARCHIVE FAILED ** Xcode's output: ↳ Writing result bundle at path: /var/folders/m7/h1mg7c7x40ddjz6mxjxm3htr0000gn/T/flutter_tools.o4LK5x/flutter_ios_build_temp_dirDQZb2l/temporary_xcresult_bundle ld: bitcode bundle could not be generated because '/Users/builder/programs/flutter_2_10_1/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Users/builder/programs/flutter_2_10_1/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter' clang: error: linker command failed with exit code 1 (use -v to see invocation) note: Using new build system note: Planning note: Build preparation complete note: Building targets in dependency order /Users/builder/clone/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'FMDB' from project 'Pods') Result bundle written to path: /var/folders/m7/h1mg7c7x40ddjz6mxjxm3htr0000gn/T/flutter_tools.o4LK5x/flutter_ios_build_temp_dirDQZb2l/temporary_xcresult_bundle Error (Xcode): Bitcode bundle could not be generated because '/Users/builder/programs/flutter_2_10_1/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Users/builder/programs/flutter_2_10_1/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter' Encountered error while archiving for device.
To solve this issue, I changed ENABLE_BITCODE value to YES in project.pbxproj but the same error occurs.
97C147071CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35SGSDC0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 56KC6SGDDR; ENABLE_BITCODE = YES; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.aaa.bbbMarket; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; };
And my CodeMagic setting for building iOS is below. my settings in CodeMagic
Our app has already been first built with xcode and updated to the apple store, and we are setting up additional CI/CD now.
How do I solve this? Any help will be highly appreciated. Thanks.