Replies: 1 comment 2 replies
-
Hi @doozMen, thanks for taking the time to report this, but unfortunately the assessment in your report seems to be wrong. The error in your report:
…lives in libswiftObservation.so, which is not something from our libraries. Also your report states that each of the libraries involved build for Linux just fine, which they do. And finally, your report specifically glosses over the solution:
The StructuredQueriesGRDBCore library in this package specifically does not depend on Sharing or Perception: So, you can use that library instead of SharingGRDB. Additionally, it is clear that you used AI to generate this report. We'd appreciate in the future that you at least provide a disclaimer that you have done so, but also we'd prefer you to just write the report yourself. This AI generated report includes many superfluous details that take up our time to read and think through. It's just really wasteful, and so in the future please take the time to minimize the discussion in your own words. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Linux/Cross-Platform Compatibility: Swift-Perception Dependency Issue
Use Case
We're developing a cross-platform desktop application in Swift that needs to run on macOS, Linux, and Windows. We're using
swift-structured-queries
for its excellent type safety and refactoring capabilities with our SQLite database.However,
swift-structured-queries
is just a query builder - it doesn't include a database driver. This is wheresharing-grdb
comes in: it provides the perfect integration betweenswift-structured-queries
and GRDB (the SQLite driver). Unfortunately, we cannot usesharing-grdb
due to a Linux compatibility issue.The Challenge
We discovered that
sharing-grdb
depends onswift-sharing
, which in turn depends onswift-perception
. This creates a blocking issue for Linux deployment:When building on Linux, we encounter linking errors:
The
swift-perception
library backports Apple's Observation framework to older platforms, but this involves platform-specific code that doesn't compile properly on Linux.The Puzzling Part
What's particularly confusing is that all these libraries individually build and test successfully on Linux:
swift-structured-queries
has Linux CI that passessharing-grdb
has Linux CI that passesswift-sharing
has Linux CI that passesswift-perception
has Linux CI that passesHowever, when integrated into our application, the linking fails. We believe this happens because:
swift::threading::fatal
appears to be an internal API that exists on Darwin but isn't properly exported on LinuxThis suggests the problem isn't with the individual libraries per se, but with how the Observation backport in
swift-perception
relies on platform-specific internals that aren't available in all Linux deployment scenarios.Our Current Workaround
Since we need
swift-structured-queries
to work with GRDB but cannot usesharing-grdb
due to the Linux linking issue, we've had to implement our own integration layer. This includes:QueryFragment
to GRDB statementsQueryBinding
toDatabaseValue
fetchAll()
,fetchOne()
, andexecute()
methodsQueryDecoder
for result mappingThis feels like reinventing the wheel when
sharing-grdb
already provides this exact functionality in a battle-tested implementation. We would much prefer to usesharing-grdb
if it could work on Linux.Proposed Solution
We'd like to discuss the possibility of making the
swift-sharing
dependency optional or creating a variant that doesn't require it. From our analysis:swift-sharing
dependency appears to be primarily used for SwiftUI integration (@SharedReader
,@Fetch
property wrappers)StructuredQueriesGRDBCore
doesn't seem to require these SwiftUI featuresPotential Approaches
#if !os(Linux) && canImport(SwiftUI)
guards around SwiftUI-specific codeStructuredQueriesGRDBCoreLinux
target without SwiftUI dependenciesQuestions
swift-sharing
that we might have missed?We're happy to contribute a PR if this aligns with the project's goals. The ability to use
sharing-grdb
on Linux would be valuable for the growing Swift-on-server and cross-platform desktop community.Thank you for creating this excellent integration between
swift-structured-queries
and GRDB! It's exactly what we need - we just need it to work on Linux without the SwiftUI dependencies.Beta Was this translation helpful? Give feedback.
All reactions