twilio / voice-quickstart-ios

Twilio Voice Quickstart for iOS with Swift
MIT License
183 stars 97 forks source link

Segfault when archiving on XCode 13.3 #497

Closed martykan closed 1 year ago

martykan commented 2 years ago

Description

On XCode 13.3, trying to build a release version or archive leads to a segmentation fault in the Swift compiler.

I believe it is related to the XCode update, since it worked before and I've seen mentions of this problem elsewhere. https://github.com/flutter/flutter/issues/100142

Steps to Reproduce

  1. Set-up the sample project eg. SwiftVoiceQuickstart
  2. Run Product -> Archive

Logs

SwiftCodeGeneration normal arm64 (in target 'SwiftVoiceQuickstart' from project 'SwiftVoiceQuickstart')
    cd /Users/tomas/voice-quickstart-ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/tomas/Library/Developer/Xcode/DerivedData/VoiceQuickstart-fdaulkhyjslphtbraqizhxydvtcw/Build/Intermediates.noindex/ArchiveIntermediates/SwiftVoiceQuickstart/IntermediateBuildFilesPath/SwiftVoiceQuickstart.build/Release-iphoneos/SwiftVoiceQuickstart.build/Objects-normal/arm64/ViewController.bc -embed-bitcode -target arm64-apple-ios11.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name SwiftVoiceQuickstart -o /Users/tomas/Library/Developer/Xcode/DerivedData/VoiceQuickstart-fdaulkhyjslphtbraqizhxydvtcw/Build/Intermediates.noindex/ArchiveIntermediates/SwiftVoiceQuickstart/IntermediateBuildFilesPath/SwiftVoiceQuickstart.build/Release-iphoneos/SwiftVoiceQuickstart.build/Objects-normal/arm64/ViewController.o

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/tomas/Library/Developer/Xcode/DerivedData/VoiceQuickstart-fdaulkhyjslphtbraqizhxydvtcw/Build/Intermediates.noindex/ArchiveIntermediates/SwiftVoiceQuickstart/IntermediateBuildFilesPath/SwiftVoiceQuickstart.build/Release-iphoneos/SwiftVoiceQuickstart.build/Objects-normal/arm64/ViewController.bc -embed-bitcode -target arm64-apple-ios11.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name SwiftVoiceQuickstart -o /Users/tomas/Library/Developer/Xcode/DerivedData/VoiceQuickstart-fdaulkhyjslphtbraqizhxydvtcw/Build/Intermediates.noindex/ArchiveIntermediates/SwiftVoiceQuickstart/IntermediateBuildFilesPath/SwiftVoiceQuickstart.build/Release-iphoneos/SwiftVoiceQuickstart.build/Objects-normal/arm64/ViewController.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/tomas/Library/Developer/Xcode/DerivedData/VoiceQuickstart-fdaulkhyjslphtbraqizhxydvtcw/Build/Intermediates.noindex/ArchiveIntermediates/SwiftVoiceQuickstart/IntermediateBuildFilesPath/SwiftVoiceQuickstart.build/Release-iphoneos/SwiftVoiceQuickstart.build/Objects-normal/arm64/ViewController.bc'.
4.  Running pass 'ObjC ARC contraction' on function '@kTVODefaultAVAudioSessionConfigurationBlock_block_invoke'
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           0x0000000108852f88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000108851f9c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108853618 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x00000001a36314c4 _sigtramp + 56
4  swift-frontend           0x00000001067d0e8c llvm::objcarc::BundledRetainClaimRVs::insertRVCallWithColors(llvm::Instruction*, llvm::CallBase*, llvm::DenseMap<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*>, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*> > > const&) + 64
5  swift-frontend           0x00000001067e1878 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1024
6  swift-frontend           0x00000001085c6e24 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1292
7  swift-frontend           0x00000001085cd38c llvm::FPPassManager::runOnModule(llvm::Module&) + 60
8  swift-frontend           0x00000001085c75a8 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1088
9  swift-frontend           0x0000000104592ee8 swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3376
10 swift-frontend           0x0000000104593e28 swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2440
11 swift-frontend           0x000000010459c364 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 180
12 swift-frontend           0x00000001040f4ea0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6976
13 swift-frontend           0x00000001040bc130 swift::mainEntry(int, char const**) + 808
14 dyld                     0x000000010b17d088 start + 516
error: Segmentation fault: 11 (in target 'SwiftVoiceQuickstart' from project 'SwiftVoiceQuickstart')

Versions

All relevant version information for the issue.

Voice iOS SDK

6.3.1

Xcode

13.3 on macOS 12.3 (M1)

rickytribbia commented 2 years ago

🖐🏻 I confirm the same issue here:

Schermata 2022-03-29 alle 12 06 51

martykan commented 2 years ago

Any updates on this please? I'd consider this a pretty high impact issue

rickytribbia commented 2 years ago

+1

rickytribbia commented 2 years ago

Hi, we've an app release waiting to resolve this archiviation issue. Has anyone found a solution or a workaround for this? @bobiechen-twilio

bobiechen-twilio commented 2 years ago

Hi everyone,

While we are able to reproduce the issue and are still investigating a solution, one workaround is to comment out the DefaultAVAudioSessionConfigurationBlock line as long as the app does not alter AVAudioSession with different configurations than the SDK's default audio device.

Sorry for the inconvenience.

-bobie

bobiechen-twilio commented 2 years ago

Hi and hope everyone is doing well. It seems that this issue is no longer reproducible on Xcode 13.4 and Xcode 14 beta.