![](/img/trans.png)
[英]Since upgrading to Xcode 10.2 I can no longer run react-native run-ios through the cli
[英]Xcode 10.2 iOS Swift (+ React Native) project compilation error
升級到 Xcode 10.2 后,我們無法再編譯項目。 我們得到了這個編譯錯誤。 看起來非常有線的 LLVM 編譯器錯誤。 據我所知,這不是 React Native 問題,但我什至無法想象如何調試這個錯誤,整個互聯網上都沒有這方面的信息。
可能有人對此有所了解嗎? 或者至少如何調試它? 謝謝。
錯誤:
LLVM ERROR: out of memory
Stack dump:
0. Program arguments: <....>
1. While emitting IR SIL function "@$sypSgIegn_Ieg_TR".
for <<debugloc at "<compiler-generated>":0:0>>0 swift 0x000000010b99eee3 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x000000010b99e6bc SignalHandler(int) + 348
2 libsystem_platform.dylib 0x00007fff697f1b3d _sigtramp + 29
3 libsystem_platform.dylib 0x00007ffee848cee0 _sigtramp + 2127147968
4 libsystem_c.dylib 0x00007fff696af1c9 abort + 127
5 swift 0x000000010b94f644 llvm::report_bad_alloc_error(char const*, bool) + 100
6 swift 0x000000010786d210 swift::irgen::CallEmission::setArgs(swift::irgen::Explosion&, bool, swift::irgen::WitnessMetadata*) + 2560
7 swift 0x0000000107a21335 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2053
8 swift 0x0000000107a016aa swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9898
9 swift 0x00000001078c0259 swift::irgen::IRGenerator::emitLazyDefinitions() + 1353
10 swift 0x00000001079e1250 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1232
11 swift 0x00000001078030b9 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49417
12 swift 0x00000001077f36de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
13 swift 0x00000001077917be main + 1246
14 libdyld.dylib 0x00007fff69606ed9 start + 1
15 libdyld.dylib 0x000000000000010f start + 2527040055
error: Abort trap: 6
這不知何故是不受支持的語法的錯誤報告¯_(ツ)_/¯ 具體在我們的案例中,問題出在 Swift 5 的新規則中(但我們在 Swift 4 上!):
在 Swift 5 模式下,@autoclosure 參數不能再轉發到另一個函數調用中的 @autoclosure 參數。
所以我們改變了:
completionHandler: resolver -> completionHandler: { resolver(nil) }
我們發現了這個問題,當切換到 Swift 5 時,XCode 報告了它。 然后我們通過此修復切換回 Swift 4,一切正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.