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

"Global is external, but doesn't have external or weak linkage!" when accessing property of element of variadic tuple in release mode; works fine for debug #78735

Open
lukaskollmer opened this issue Jan 18, 2025 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@lukaskollmer
Copy link

lukaskollmer commented Jan 18, 2025

Description

Note this issue is likely related to #78734, since the repoduction code is essentially the same, with just small changes to the file structure.


Compiling the Xcode project in this repo in a release configuration results in a compiler error.

The Xcode project consists of an empty SwiftUI multiplatform app (not relevant) and an embedded SPM package with 2 targets, one of which depends on the other.

One target defines a function which uses, as part of a variadic-generic tuple, a type defined in the other target.
This type has a private enum carrying some data, which somehow seems to cause an issue with the compiler/linker.

Adding a second file (even if it's empty) changes the issue here from a compiler crash to a linker error (see #78734).
Moving all files from the second target in the embedded SPM package into the first seems to make it compile fine.

Reproduction

see the Xcode project linked above

Stack dump

Global is external, but doesn't have external or weak linkage!
ptr @"$s14SpeziHealthKit0bC10SampleTypeV7Variant33_A39852838F61AC8D994C4428027C5577LLOMa"
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
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           0x0000000106896a9c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000106894cf0 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000106897068 SignalHandler(int) + 292
3  libsystem_platform.dylib 0x000000019e9eae04 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000019e9b3f70 pthread_kill + 288
5  libsystem_c.dylib        0x000000019e8c0908 abort + 128
6  swift-frontend           0x00000001015f7ce8 createDispatchingDiagnosticConsumerIfNeeded(swift::FrontendInputsAndOutputs const&, llvm::function_ref<std::__1::unique_ptr<swift::DiagnosticConsumer, std::__1::default_delete<swift::DiagnosticConsumer>> (swift::InputFile const&)>) + 0
7  swift-frontend           0x0000000106806820 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
8  swift-frontend           0x0000000106806708 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
9  swift-frontend           0x0000000101837bd4 llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::printPipeline(llvm::raw_ostream&, llvm::function_ref<llvm::StringRef (llvm::StringRef)>) + 0
10 swift-frontend           0x00000001065ce420 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 224
11 swift-frontend           0x000000010182c6bc swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*, llvm::raw_pwrite_stream*) + 3764
12 swift-frontend           0x000000010182e2f8 swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, llvm::vfs::OutputBackend&, swift::UnifiedStatsReporter*) + 2352
13 swift-frontend           0x0000000101835520 (anonymous namespace)::LLVMCodeGenThreads::Thread::run() + 156
14 swift-frontend           0x0000000101835478 (anonymous namespace)::LLVMCodeGenThreads::runThread(void*) + 12
15 libsystem_pthread.dylib  0x000000019e9b42e4 _pthread_start + 136
16 libsystem_pthread.dylib  0x000000019e9af0fc thread_start + 8

Expected behavior

It should work

Environment

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0

(Xcode 16.2)

Additional information

No response

@lukaskollmer lukaskollmer added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Jan 18, 2025
lukaskollmer added a commit to StanfordSpezi/SpeziHealthKit that referenced this issue Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant