Compiler Error trap 6 in xcframework

I have a wired case where I get a trap 6 error trying to compile an framework. Doing via the command line works, though.

What could be the difference?

I tried clean/building, optimization settings and incremental vs non-incremental building, already.

--- snip ---
Global is external, but doesn't have external or weak linkage!
i64* @"s9MotionSDK12BaseRecorderC6_state33_2FDBCA713350FCCD4211F219EC8B29F3LL7Combine9PublishedVyAA0D5StateOGvpWvd" <unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log <unknown>:0: note: Broken module found, compilation aborted! Stack dump: 0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/oliver/Desktop/MotionSDK/MotionSDK/DTOs/TripDTO.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Extensions/CLPlacemark+wrappedDescription.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/DTOs/SessionDTO.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Config.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/DTOs/LocationDTO.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/MotionActivityManager.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Extensions/CLAuthorizationStatus+description.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Model/Trip.swift -primary-file /Users/oliver/Desktop/MotionSDK/MotionSDK/AutomaticRecorder.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Services/CodableFileBuffer.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/BaseRecorder.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Extensions/CMMotionActivity+extensions.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/DTOs/ErrorResponseDTO.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Services/Storage.swift /Users/oliver/Desktop/MotionSDK/MotionSDK/Extensions/FileManager+description.swift -emit-module-path /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/Objects-normal/arm64/AutomaticRecorder~partial.swiftmodule -emit-module-doc-path /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/Objects-normal/arm64/AutomaticRecorder~partial.swiftdoc -serialize-diagnostics-path /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/Objects-normal/arm64/AutomaticRecorder.dia -emit-dependencies-path /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/Objects-normal/arm64/AutomaticRecorder.d -emit-reference-dependencies-path /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/Objects-normal/arm64/AutomaticRecorder.swiftdeps -target arm64-apple-ios13.2 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -I /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Products/Debug-iphoneos -F /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Products/Debug-iphoneos -enable-library-evolution -enable-testing -g -import-underlying-module -module-cache-path /Users/oliver/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/oliver/Desktop/MotionSDK -enable-anonymous-context-mangled-names -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/MotionSDK-generated-files.hmap -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/MotionSDK-own-target-headers.hmap -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/MotionSDK-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/MotionSDK-project-headers.hmap -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Products/Debug-iphoneos/include -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/DerivedSources-normal/arm64 -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/DerivedSources/arm64 -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/unextended-module-overlay.yaml -module-name MotionSDK -o /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Build/Intermediates.noindex/MotionSDK.build/Debug-iphoneos/MotionSDK.build/Objects-normal/arm64/AutomaticRecorder.o -embed-bitcode-marker -index-store-path /Users/oliver/Library/Developer/Xcode/DerivedData/MotionSDK-anivyzfqsokdlehaikaafvngtptp/Index/DataStore -index-system-modules 0 swift 0x000000010d528a63 PrintStackTraceSignalHandler(void*) + 51 1 swift 0x000000010d528236 SignalHandler(int) + 358 2 libsystem_platform.dylib 0x00007fff6a40e42d _sigtramp + 29 3 libsystem_platform.dylib 0x00007ffee6b2c070 _sigtramp + 2087836768 4 libsystem_c.dylib 0x00007fff6a2e3a1c abort + 120 5 swift 0x0000000109169530 std::__1::unique_ptr<swift::DiagnosticConsumer, std::__1::default_delete<swift::DiagnosticConsumer> > llvm::function_ref<std::__1::unique_ptr<swift::DiagnosticConsumer, std::__1::default_delete<swift::DiagnosticConsumer> > (swift::InputFile const&)>::callback_fn<createSerializedDiagnosticConsumerIfNeeded(swift::FrontendInputsAndOutputs const&)::_15>(long, swift::InputFile const&) + 0
6 swift 0x000000010d4a1886 llvm::report_fatal_error(llvm::Twine const&, bool) + 278
7 swift 0x000000010d4a176b llvm::report_fatal_error(char const*, bool) + 43
8 swift 0x000000010d461a4c (anonymous namespace)::VerifierLegacyPass::doFinalization(llvm::Module&) + 204
9 swift 0x000000010d402fd3 llvm::FPPassManager::doFinalization(llvm::Module&) + 51
10 swift 0x000000010d40b622 llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 82
11 swift 0x00000001093828d5 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex, llvm::GlobalVariable, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 4677
12 swift 0x0000000109172fc2 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 38274
13 swift 0x0000000109166234 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
14 swift 0x00000001090f3733 main + 1219
15 libdyld.dylib 0x00007fff6a2157fd start + 1
16 libdyld.dylib 0x0000000000000062 start + 2514397286
error: Abort trap: 6 (in target 'MotionSDK' from project 'MotionSDK')

--- snip ---

1 Like

For everyone interested. I was inheriting a BaseRecorder and in it's subclass setting the @Published property state from BaseRecorder. All worked fine from the command line but Xcode failed to compile this. Setting super.state instead of state solved that issue for me.

Does this still crash on the latest Xcode 11.4 beta? If so, please file an bug about this. The compiler shouldn’t crash just ’cause you code is incorrect.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

Yes! It does :-( Here's the smallest example I could come up with. Only happens inside an xcframework, though.

import Foundation
import Combine

public enum RecorderState: String {
    case idle = "Idle"
    case recording = "Recording"
    case monitoring = "Monitoring"
}


public class BaseRecorder: NSObject, ObservableObject {
    @Published public var state = RecorderState.idle

    func start() {
        state = .recording
    }
}

public class AutomaticRecorder: BaseRecorder {

    override func start() {
        super.start()
    }
}

I'll create a bug report. Sorry for the delay. 1. SR-12458

Terms of Service

Privacy Policy

Cookie Policy