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)
清理您的项目并再次运行:“存档”构建。
我在M1 Mac上遇到了类似的问题,以下是我解决此问题的方法:
brew install watchmanbrew install nodesudo arch -x86_64 gem install ffipost_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)
cd ios/ && arch -x86_64 pod install。
使用 Rosetta 运行 Xcode。
。
您可以通过运行以下命令来安装 Rosetta:softwareupdate --install-rosetta
干净的构建 - 打开 xcode 然后按 Command + Shift + K
我面临这个错误是因为我的React Native project version is "0.62.2" and my Xcode version is 14.3
所以,我只是更新:-
1. 更新 Xcode 中的库搜索路径
您需要在 Xcode 中更改库搜索路径:
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 次 |
| 最近记录: |