LLVM crashes in Xcode 11.2 with Build Libraries for Distribution

I'm managing releases for a large open-source Swift project for Apple platforms (AudioKit), and we're trying to build a xcframework for it.

The first step in attempting to do this - simply turning on the Build Libraries for Distribution setting - led to some very strange behavior, namely segmentation faults from LLVM when run in xcodebuild.

Stack dump:
0.	Running pass 'Function Pass Manager' on module '/Users/megastep/src/ak/AudioKit/AudioKit/iOS/build/AudioKit For iOS.build/Release-iphonesimulator/AudioKit.build/Objects-normal/x86_64/AKReverb2.o'.
1.	Running pass 'X86 Assembly Printer' on function '@"$s8AudioKit11AKMIDIEventV15internalPacketsSaySays5UInt8VGGvg"'
0  swift                    0x000000010cd21a13 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010cd211e6 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff657e8b1d _sigtramp + 29
3  libsystem_platform.dylib 0x000000010e372080 _sigtramp + 2830669184
4  swift                    0x000000010cac5740 (anonymous namespace)::MCMachOStreamer::EmitInstToData(llvm::MCInst const&, llvm::MCSubtargetInfo const&) + 192
5  swift                    0x000000010cacce86 llvm::MCObjectStreamer::EmitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&, bool) + 710
6  swift                    0x0000000109c3d623 llvm::X86AsmPrinter::EmitInstruction(llvm::MachineInstr const*) + 21683
7  swift                    0x000000010a0a4ecc llvm::AsmPrinter::EmitFunctionBody() + 5740
8  swift                    0x00000001099eea08 llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) + 296
9  swift                    0x000000010ade6a44 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 308
10 swift                    0x000000010cbfccf6 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1590
11 swift                    0x000000010cbfc4c3 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
12 swift                    0x000000010cc09c27 llvm::legacy::PassManager::run(llvm::Module&) + 1655
13 swift                    0x0000000108b7d23d swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 7549
14 swift                    0x0000000108b81190 (anonymous namespace)::LLVMCodeGenThreads::Thread::run() + 208
15 swift                    0x0000000108b81039 (anonymous namespace)::LLVMCodeGenThreads::runThread(void*) + 9
16 libsystem_pthread.dylib  0x00007fff657f3d36 _pthread_start + 125
17 libsystem_pthread.dylib  0x00007fff657f058f thread_start + 15
error: Segmentation fault: 11 (in target 'AudioKit' from project 'AudioKit For iOS')

I should point out that the codebase is a large mix of mostly Swift with also a lot of Objective-C, C and C++ code. So maybe this has something to do with this crash, but in any case segfaults should never happen in a compiler.

Another weird thing is that when building the project in Xcode this crash doesn't seem to happen - mostly command line builds seem to be affected (without overriding any settings).

Does anybody have any insights on this kind of crash?

Terms of Service

Privacy Policy

Cookie Policy