【问题标题】:iOS build failed with `ld: bitcode bundle could not be generated`iOS 构建失败并出现“ld:无法生成位码包”
【发布时间】:2022-07-14 23:38:34
【问题描述】:

使用 CodeMagic 构建 iOS 时出现以下错误。

    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.

为了解决这个问题,我将 project.pbxproj 中的 ENABLE_BITCODE 值更改为 YES,但出现了同样的错误。

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;
    };

下面是我用于构建 iOS 的 CodeMagic 设置。 my settings in CodeMagic

我们的应用已经先用 xcode 构建并更新到了苹果商店,我们现在正在设置额外的 CI/CD。

我该如何解决这个问题?任何帮助将不胜感激。谢谢。

【问题讨论】:

    标签: ios flutter bitcode codemagic


    【解决方案1】:

    我也有类似的问题。 我的解决方案是转到 Xcode-Product-Scheme-edit scheme-确保归档模式构建配置设置为 Release。 我的由于某种原因被设置为调试。

    【讨论】:

      【解决方案2】:

      我认为解决方案与您需要禁用位码相反,因为 Flutter 不使用它。您可以通过将 Podfile 编辑为以下内容来做到这一点:

      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
      

      你可以在这里找到更多细节https://github.com/flutter/flutter/issues/78589

      【讨论】:

      • 对于任何尝试运行此命令的人,ENABLE_BITCODE 末尾缺少一个单引号 - 请务必添加它。
      • 感谢@JasonMaldonis 修复了它
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-08
      • 1970-01-01
      • 1970-01-01
      • 2021-01-15
      • 1970-01-01
      • 2021-11-11
      • 2020-05-07
      相关资源
      最近更新 更多