swift-structured-queries: Compilation error in archive build
Description
We’re getting a compilation error when doing an archive build. Non-archive debug and release builds work.
Checklist
- I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- If possible, I’ve reproduced the issue using the
mainbranch of this package. - This issue hasn’t been addressed in an existing GitHub issue or discussion.
Expected behavior
No response
Actual behavior
error: <unknown>:0: unsupported relocation with subtraction expression, symbol '_$s12CamerasModel15RAWImageSupportV12TableColumnsVMn' can not be undefined in a subtraction expression
Here’s the type that the error points to
@Table
public struct RAWImageSupport: Identifiable, Equatable, Codable, Sendable {
public let id: Int
public var cameraId: Camera.ID
public var imageType: ImageType
public var processor: RAWImageDataProcessor
public var match: RAWImageOptionMatch
public var evalRendered: Bool?
public var evalRenderedSizeMatch: Bool?
public var autoStatus: RAWImageSupportStatus?
public var adminStatus: RAWImageSupportStatus?
public var note: String? = nil
}
Reproducing project
No response
Structured Queries version information
0.5.1
Destination operating system
macOS 14
Xcode version information
16.4
Swift Compiler version information
swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 25 (16 by maintainers)
Ok, this solution needs to be finessed a little more. It definitely works for non-primary keyed tables, so just have to handle PKTs correctly. Will pick back up on Monday.
Ok, I may have had something cached when it worked for me. We do need to properly apply
@attached(member)because we are adding new members. But that means we need to do some work to separate parts of theMemberAttributeMacroconformance into aMemberMacroconformance. It’s possible, and it will work, but it will take a little more time.@rcarver I seems indeed that you need to inline all tables in the target for it to reliably build in release mode. We were like you kind of mid-way migrating away from GRDB records. We’ll likely pause until the issue is resolved.
FWIW, I’m able to archive just fine, but this is simple Release mode that is broken in my case. I suspect that some ordering happens when archiving that fixes my issue and creates yours.