Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling crash with swift 5.6 #90

Closed
rickytribbia opened this issue Mar 24, 2022 · 9 comments
Closed

Compiling crash with swift 5.6 #90

rickytribbia opened this issue Mar 24, 2022 · 9 comments

Comments

@rickytribbia
Copy link

Description

Hi all, thanks for your great work.
We're developing an app that use TwilioVoice and we deploy this app many times in previous months; it has already voice functionality like make/receive voip calls between different user (client)
In these days, indeed, we couldn't archive successfully our app and it seems to be caused by something related to your sdk and latest swift version; I hope to be wrong: in this case I need your help to check it out.

Important: when we build the app in debug mode (for example for development purpose using simulator or phisical device) we haven't any issue and it builds always successfully.

Steps to Reproduce

  1. Archive an app with TwilioVoice that set audioDevice.block with DefaultAVAudioSessionConfigurationBlock

Code

As your sample in our application we have:

// The mode set by the Voice SDK is "VoiceChat" so the default audio route is the built-in receiver. Use port override to switch the route.
audioDevice.block = {
    DefaultAudioDevice.DefaultAVAudioSessionConfigurationBlock() // it seems to be the incriminated line.
    
    do {
        if toSpeaker {
            try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
        } else {
            try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
        }
    } catch {
        NSLog(error.localizedDescription)
    }
}

audioDevice.block()

Expected Behavior

We expect to archive the app successfully like previous times 😅

Actual Behavior

❌  error: Abort trap: 6 (in target 'Moolti' from project 'Moolti')



❌  error: backend command failed due to signal 6 (use -v to see invocation)


** ARCHIVE FAILED **


The following build commands failed:
	SwiftCodeGeneration normal arm64 (in target 'Moolti' from project 'Moolti')
	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Moolti' from project 'Moolti')
(2 failures)
ERROR [2022-03-24 10:42:58.44]: Exit status: 65

Reproduces How Often

Always

Logs

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/{my_user}/Library/Developer/Xcode/DerivedData/MyAppThatUseTwilioVoice-ctnnvymzjxwgqecsjknxgmiguppd/Build/Intermediates.noindex/ArchiveIntermediates/MyAppThatUseTwilioVoice/IntermediateBuildFilesPath/MyAppThatUseTwilioVoice.build/Release-iphoneos/MyAppThatUseTwilioVoice.build/Objects-normal/arm64/CallManager.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           0x00000001067dcde7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x00000001067dbe38 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x00000001067dd440 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff80d9cfe2d _sigtramp + 29
4  swift-frontend           0x00000001064edec7 llvm::Intrinsic::matchIntrinsicSignature(llvm::FunctionType*, llvm::ArrayRef<llvm::Intrinsic::IITDescriptor>&, llvm::SmallVectorImpl<llvm::Type*>&) + 151
5  libsystem_c.dylib        0x00007ff80d906d10 abort + 123
6  swift-frontend           0x0000000106729cda llvm::report_bad_alloc_error(char const*, bool) + 106
7  swift-frontend           0x0000000106729cf2 out_of_memory_new_handler() + 18
8  libc++abi.dylib          0x00007ff80d9789bb operator new(unsigned long) + 43
9  swift-frontend           0x00000001064eaefd llvm::Function::BuildLazyArguments() const + 77
10 swift-frontend           0x00000001042d3e87 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&) + 151
11 swift-frontend           0x00000001042e6f88 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1384
12 swift-frontend           0x0000000106522380 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1488
13 swift-frontend           0x0000000106529073 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
14 swift-frontend           0x0000000106522b39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1161
15 swift-frontend           0x0000000101a406df swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3791
16 swift-frontend           0x0000000101a418cc swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2812
17 swift-frontend           0x0000000101a4aaa5 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 213
18 swift-frontend           0x0000000101505795 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 16565
19 swift-frontend           0x00000001014c45d4 swift::mainEntry(int, char const**) + 1108
20 dyld                     0x00000001135254fe start + 462
error: Abort trap: 6 (in target 'MyAppThatUseTwilioVoice' from project 'MyAppThatUseTwilioVoice')

error: backend command failed due to signal 6 (use -v to see invocation)

Voice iOS SDK

We're using latest pod version: 6.3.1 via cocoapods

Xcode

13.3

iOS Version

Deployment target 12.1

iOS Device

Build archive, generic iOS Device

@bobiechen-twilio
Copy link
Contributor

Thanks for reporting this @rickytribbia.

I have created an internal ticket for tracking. Will keep you updated.

-bobie

@rickytribbia
Copy link
Author

🤩 🤩 🤩

Thank you

@rickytribbia
Copy link
Author

Hi @bobiechen-twilio any update?
We've tried to reproduce the issue trying to archiving your quickstart project and it happens.
I see that in this repo there is also already the same issue

@rickytribbia
Copy link
Author

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

@michaelmoneypenny
Copy link

michaelmoneypenny commented Apr 13, 2022

This sounds very similar to an issue we're having in our build pipeline when switching to Xcode 13.3 / 13.3.1
The only stable version so far is up to 13.1

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_13.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/do/Library/Developer/Xcode/DerivedData/appname-xx/Build/Intermediates.noindex/ArchiveIntermediates/appname/IntermediateBuildFilesPath/xxxxxxbuild/AdHoc-iphoneos/xxxxx.build/Objects-normal/arm64/TwilioAudioRouter.bc -embed-bitcode -target arm64-apple-ios14.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name xxxxxxxx -o /Users/do/Library/Developer/Xcode/DerivedData/appname-xxx/Build/Intermediates.noindex/ArchiveIntermediates/appname/IntermediateBuildFilesPath/xxxxxx.build/AdHoc-iphoneos/xxxxxx.build/Objects-normal/arm64/TwilioAudioRouter.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/devops/Library/Developer/Xcode/DerivedData/appname-xxxx/Build/Intermediates.noindex/ArchiveIntermediates/appname/IntermediateBuildFilesPath/xxxxxx.build/AdHoc-iphoneos/xxxxxxx.build/Objects-normal/arm64/TwilioAudioRouter.bc'.
4.	Running pass 'ObjC ARC contraction' on function '@kTVODefaultAVAudioSessionConfigurationBlock_block_invoke

@lsitar-FYF
Copy link

@michaelmoneypenny @rickytribbia I am having the same exact issue when trying to archive my project. It runs fine when I build and run on a device but when I archive it gives me Abort Trap 6 with same stack trace. I found a fix by going into Build Settings > 'Enable Bitcode = No'. Not sure if enabling bitcode affects functionality but it let me archive after setting it to NO.

@michaelmoneypenny
Copy link

@michaelmoneypenny @rickytribbia I am having the same exact issue when trying to archive my project. It runs fine when I build and run on a device but when I archive it gives me Abort Trap 6 with same stack trace. I found a fix by going into Build Settings > 'Enable Bitcode = No'. Not sure if enabling bitcode affects functionality but it let me archive after setting it to NO.

Thanks Isitar, I have read that this is a bitcode issue - if the issue keeps hanging around I will have to disable bitcode. I don't think it will affect functionality, from my very basic understanding it trims the size of your app and allows apple to re-optimise by device it when it reaches the App Store

@bobiechen-twilio
Copy link
Contributor

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

@michaelmoneypenny
Copy link

Hi @bobiechen-twilio I'll try updating our build machine and see what happens, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants