未找到架构 arm64 的符号 - XCode

Lui*_*oga 11 macos xcode ios arm64 react-native

我正在尝试在 Mac Intel 上构建我的 React Native 项目,但不断收到下一个错误:

Showing All Messages
Undefined symbol: _swift_stdlib_isStackAllocationSafe
Run Code Online (Sandbox Code Playgroud)

架构arm64的未定义符号:“_swift_stdlib_isStackAllocationSafe”,引用自:函数签名专门化<Arg 1 = Owned Toguaranted>函数签名专门化<Arg[0] = [Closure Propagated:closure #1 (__C.SKProduct) -> Swift。闭包中的 Bool #2 (Swift.Set<__C.SKProduct>) -> () 位于 PurchasesCoreSwift.IntroEligibilityCalculator.checkTrialOrIntroductoryPriceEligibility(with: Foundation.Data, ProductIdentifiers: Swift.Set<Swift.String>, 完成: (Swift.Dictionary< Swift.String、__C.NSNumber>、Swift.Optional<Swift.Error>) -> ()) -> (),参数类型:通用专业化 <__C.SKProduct> 的 [Swift.Set<Swift.String>]> libPurchasesCoreSwift.a(IntroEligibilityCalculator.o) 中的 Swift._NativeSet.filter((A) throws -> Swift.Bool) throws -> Swift._NativeSet ld: 未找到架构 arm64 clang 的符号:错误:链接器命令失败退出代码为 1(使用 -v 查看调用)

我已经尝试了几乎所有答案:link

pod deintegrate 
pod install
pod repo update
Run Code Online (Sandbox Code Playgroud)

我的反应本机版本:

"react-native": "0.64.2"
Run Code Online (Sandbox Code Playgroud)

我的项目的架构: 架构

带库的链接二进制文件 链接二进制文件

更新 我还将 React Native 版本更新到 0.67.4 但仍然无法工作。

Lui*_*oga 14

对于react-native 0.67+:经过大量研究,我从 Vegaro 找到了下一个解决方案:

解决方案链接

第一步是将 Revenuecat 包的 react-native-purchases 升级到最新版本。

清洁你的豆荚: 正确清洁豆荚的参考链接

声明 pod 安装后过程:将以下内容添加到 Podfile 中:

 post_install do |installer|
    react_native_post_install(installer)
    fix_library_search_paths(installer)
  end
end

def fix_library_search_paths(installer)
  def fix_config(config)
    lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
    if lib_search_paths
      if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
        # since the libraries there are only built for x86_64 and i386.
        lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
        lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
          # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
          lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
        end
      end
    end
  end

  projects = installer.aggregate_targets
    .map{ |t| t.user_project }
    .uniq{ |p| p.path }
    .push(installer.pods_project)

  projects.each do |project|
    project.build_configurations.each do |config|
      fix_config(config)
    end
    project.native_targets.each do |target|
      target.build_configurations.each do |config|
        fix_config(config)
      end
    end
    project.save()
  end
end 
Run Code Online (Sandbox Code Playgroud)

最后,手动更改项目中的库搜索路径 (XCode)。消除:

$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
Run Code Online (Sandbox Code Playgroud)

添加:

$(SDKROOT)/usr/lib/swift
Run Code Online (Sandbox Code Playgroud)

清理您的项目并再次运行:“存档”构建。


Ash*_*est 7

如果您可以这样做,请更新您的 React Native 版本。0.67 版本修复了这个问题。

如果无法更新,最简单的解决方案是更新您的库搜索路径。

在 Xcode 中选择您的项目,然后转到“Build Settings”。向下滚动,直到看到“搜索路径”,最后看到“库搜索路径”。"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"用。。。来代替"$(SDKROOT)/usr/lib/swift"

库搜索路径

这个解决方案归功于 Vegaro,他将其发布在此处,如果这对您不起作用,我认为这是一个更具侵入性的选项。


Vla*_*nin 5

我在M1 Mac上遇到了类似的问题,以下是我解决此问题的方法:

  1. brew install watchman
    如果你没有节点=>brew install node
  2. sudo arch -x86_64 gem install ffi
  3. 在 ios 文件夹内的 pod 文件末尾添加以下代码:
post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
      end
    end
  end
Run Code Online (Sandbox Code Playgroud)
  1. cd ios/ && arch -x86_64 pod install

  2. 使用 Rosetta 运行 Xcode。
    在此输入图像描述
    您可以通过运行以下命令来安装 Rosetta:softwareupdate --install-rosetta

  3. 排除架构arm64。 在此输入图像描述

  4. 干净的构建 - 打开 xcode 然后按 Command + Shift + K


  1. 如果您使用nvm尝试替换NODE_BINARY=node为命令的实际结果which node,在我的例子中,它看起来像这样:在此输入图像描述
    在此输入图像描述

大声喊出这些答案: 二三

  • 如果您确实有兴趣永久解决此问题,则不建议使用 Rosetta 作为长期解决方案。 (2认同)

Dee*_*ngh 5

我面临这个错误是因为我的React Native project version is "0.62.2" and my Xcode version is 14.3

所以,我只是更新:-

1. 更新 Xcode 中的库搜索路径

您需要在 Xcode 中更改库搜索路径:

  • 删除“$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)”
  • 添加“$(SDKROOT)/usr/lib/swift”

在此输入图像描述

2. 在 Podfile 中添加新的 fix_library_search_paths 功能

在你的 podfile 中找到post_install部分并添加一行 fix_library_search_paths(installer)并函数本身。之后应该可以工作。

post_install do |installer|
     flipper_post_install(installer)
   fix_library_search_paths(installer)
 end
end
 
def fix_library_search_paths(installer)
def fix_config(config)
lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
if lib_search_paths
 if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
   # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 arm64 (Apple M1)
   # since the libraries there are only built for x86_64 and i386.
   lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
   lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
   if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
     # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
     lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
   end
 end
 end
 end

 projects = installer.aggregate_targets
 .map{ |t| t.user_project }
 .uniq{ |p| p.path }
 .push(installer.pods_project)

 projects.each do |project|
 project.build_configurations.each do |config|
 fix_config(config)
 end
 project.native_targets.each do |target|
 target.build_configurations.each do |config|
   fix_config(config)
 end
 end
 project.Save()
end
end
Run Code Online (Sandbox Code Playgroud)

另外,据说更新也RN to >= 0.67有帮助。


归档时间:

查看次数:

37304 次

最近记录:

2 年,11 月 前