【问题标题】:Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture x86_64Xcode 12,为 iOS 模拟器构建,但在为 iOS 构建的目标文件中链接,用于架构 x86_64
【发布时间】:2021-01-08 04:30:54
【问题描述】:

有Xcode错误信息:

在 FFmpeg/Classes/lib/libavcodec.a(aacencdsp.o) 中,为 iOS 构建 模拟器,但在为独立构建的目标文件中链接,文件 'FFmpeg/Classes/lib/libavcodec.a' 适用于 x86_64 架构。

我的库文件 libavcodec.a 支持 x86_64、i386、arm64、armv7 arm7 等。

我在Podfile 中设置了以下代码,然后在pod install 中设置了以下代码,但没有工作。

config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
config.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = 'x86_64'

【问题讨论】:

  • 您是从 SDK 还是从您的代码中收到此错误?我在使用 Braintree SDK 时遇到了同样的错误
  • 我有与 GoogleSignIn 相同的问题“为 iOS 模拟器构建,但链接到为 iOS 构建的目标文件,文件 '/Volumes/.../Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn ' 用于架构 arm64" 但仅在使用 xcodebuild 构建时
  • 我在使用 xxx.a 静态库时遇到了同样的错误。 lib架构是armv7 i386 x86_64 arm64
  • 我有同样的错误。你是怎么解决的?

标签: ios xcode12


【解决方案1】:

我有同样的问题,我在 Xcode 版本 12 上试过这个

将您的 react-native-ffmpeg 版本更改为 package.json 中的 0.4.4 版

即“react-native-ffmpeg”:“0.4.4”

更新库

你的项目根目录中的“npm install”

清理 react-native-ffmpeg pod 缓存

cd ios

pod cache clean react-native-ffmpeg --all

更新 [ios] 文件夹中的 pod 文件。

将包含 react-native-ffmpeg 的行替换为以下内容

pod 'react-native-ffmpeg/https-lts', :path => '../node_modules/react-native-ffmpeg'

安装 Pod

cd ios

吊舱安装

清理您的应用构建文件夹。

在 Xcode 中打开您的项目,然后按 (⇧⌘K) 清理您的构建。 或 -> 在 Xcode 中转到(产品 => 清理构建文件夹)。

✅ 现在从 Xcode 运行您的应用程序。

参考:https://github.com/tanersener/react-native-ffmpeg/issues/196#issuecomment-700935317 Salehjarad 评论

【讨论】:

    【解决方案2】:

    我想你会在这里找到答案https://stackoverflow.com/a/63955114/2864316

    基本上,您需要从模拟器构建中排除 arm64 架构。您可以手动执行此操作,也可以按照链接答案中的详细说明更改您的 pod 文件。

    至少这个答案解决了我的问题?

    【讨论】:

    • 我之前读过这个问题,但对我没有帮助。
    【解决方案3】:

    我有同样的问题。我使用 react-native,但 react-native-ffmpeg 依赖于 mobile-ffmpeg。我的解决方案是使用 LTS 版本的包。

    【讨论】:

      【解决方案4】:

      把它放在 Podfile 的末尾:

      post_install do |installer|
        installer.pods_project.build_configurations.each do |config|
          config.build_settings[‘EXCLUDED_ARCHS[sdk=iphonesimulator*]’] = ‘arm64’
      

      config.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = 'x86_64' 结尾 结束

      基本上你可能必须这样做:

      1. 主要项目目标
      2. Pod 项目目标

      【讨论】:

      • 感谢您的回答。但是,它没有用。我的问题是for architecture x86_64,而不是 arm64。我已经和你之前说的一样做了。
      猜你喜欢
      • 1970-01-01
      • 2020-12-15
      • 1970-01-01
      • 2022-07-02
      • 2021-12-25
      • 1970-01-01
      • 2021-01-17
      • 2021-05-27
      • 2021-04-28
      相关资源
      最近更新 更多