Swift error: Abort trap: 6 (in target 'ZLPhotoBrowser' from project 'Pods') 的解决办法

升级了macOS 12.3Xcode 13.3之后,Archive时出现如下错误提示(真机运行没有问题):

SwiftCodeGeneration normal arm64 (in target 'ZLPhotoBrowser' from project 'Pods')
    cd /Users/xxx/iosapp/iosapp/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.bc -embed-bitcode -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name ZLPhotoBrowser -o /Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.o

LLVM ERROR: out of memory
Allocation failed
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.bc -embed-bitcode -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name ZLPhotoBrowser -o /Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.o
1.  Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2.  Compiling with the current language version
3.  Running pass 'Function Pass Manager' on module '/Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.bc'.
4.  Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x00000001129f2de7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x00000001129f1e38 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x00000001129f3440 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff81c1b7dfd _sigtramp + 29
4  libsystem_malloc.dylib   0x00007ff81bfd5abb _malloc_zone_malloc + 125
5  libsystem_c.dylib        0x00007ff81c0edd24 abort + 123
6  swift-frontend           0x000000011293fcda llvm::report_bad_alloc_error(char const*, bool) + 106
7  swift-frontend           0x000000011293fcf2 out_of_memory_new_handler() + 18
8  libc++abi.dylib          0x00007ff81c15f96b operator new(unsigned long) + 43
9  swift-frontend           0x0000000112700efd llvm::Function::BuildLazyArguments() const + 77
10 swift-frontend           0x00000001104e9e87 llvm::objcarc::BundledRetainClaimRVs::insertRVCallWithColors(llvm::Instruction*, llvm::CallBase*, llvm::DenseMap, llvm::DenseMapInfo, llvm::detail::DenseMapPair > > const&) + 151
11 swift-frontend           0x00000001104fcf88 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1384
12 swift-frontend           0x0000000112738380 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1488
13 swift-frontend           0x000000011273f073 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
14 swift-frontend           0x0000000112738b39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1161
15 swift-frontend           0x000000010dc566df swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3791
16 swift-frontend           0x000000010dc578cc swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2812
17 swift-frontend           0x000000010dc60aa5 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 213
18 swift-frontend           0x000000010d71b795 swift::performFrontend(llvm::ArrayRef, char const*, void*, swift::FrontendObserver*) + 16565
19 swift-frontend           0x000000010d6da5d4 swift::mainEntry(int, char const**) + 1108
20 dyld                     0x00000001157fe51e start + 462
error: Abort trap: 6 (in target 'ZLPhotoBrowser' from project 'Pods')

里面有两点:

  • Please submit a bug report ......
  • error: Abort trap: 6 (in target 'ZLPhotoBrowser' from project 'Pods')
    第一个由于有人已经向Swift提交了bug report,我就没有重复提交。于是根据第二点关键字来查找解决办法,但是一顿操作下来在ZLPhotoBrowserIssues里面找到了临时解决办法,就是将ZLPhotoBrowserpod库设的Enable Bitcode设置为false,重新Archive就可以了。具体真正的原因,还要等Swift官方说明一下。
    附带Issues地址。

你可能感兴趣的:(Swift error: Abort trap: 6 (in target 'ZLPhotoBrowser' from project 'Pods') 的解决办法)