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

"Undefined symbol: type metadata accessor" when accessing property of element of variadic tuple in release mode; works fine for debug builds #78734

Open
lukaskollmer opened this issue Jan 18, 2025 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. 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 #78735, 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.

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. this seems (my guess) like it is maybe related to cross-file and cross-module optimizations (since it cannot be reproduced in a single file or a single module).

Expected behavior

since the code compiles fine in a debug build, it should also compile in a release build.

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

Undefined symbols for architecture arm64:
  "type metadata accessor for SpeziHealthKit.HealthKitSampleType.(Variant in _A39852838F61AC8D994C4428027C5577)", referenced from:
      function signature specialization <Arg[1] = Stack Promoted from Box> of imp #1 <each A><A1 where A: SpeziHealthKit._SampleWithSampleType, A1: SpeziHealthKit._SampleWithSampleType>(SpeziHealthKitUI.Entry<A1>) -> () in SpeziHealthKitUI.hmmmm<each A where A: SpeziHealthKit._SampleWithSampleType>((repeat SpeziHealthKitUI.Entry<A>)) -> [(Swift.String, SwiftUI.Color)] in SpeziHealthKitUI.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@lukaskollmer lukaskollmer added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. 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. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant