Skip to content

Compiler flag support for SQLite.swift and Android#59

Closed
marcprux wants to merge 4 commits intosbooth:mainfrom
swift-everywhere:main
Closed

Compiler flag support for SQLite.swift and Android#59
marcprux wants to merge 4 commits intosbooth:mainfrom
swift-everywhere:main

Conversation

@marcprux
Copy link
Copy Markdown

@marcprux marcprux commented Jan 7, 2025

This PR adds the necessary compile flags to work as a custom SQLite build for https://github.com/stephencelis/SQLite.swift, as well as adding support for building and testing on Android.

Prior to this fix, attempting to run the SQLite.swift tests on macOS or Android would crash at:

Test Case '-[SQLiteTests.ConnectionAttachTests test_attach_detach_file_database]' started.
error: Exited with unexpected signal code 11

@sbooth
Copy link
Copy Markdown
Owner

sbooth commented Jan 7, 2025

Thanks for this PR. Android support would be a nice addition.

Many of those flag changes are not ones I'm keen to make. I understand the rationale but I am hesitant to deviate from the official SQLite recommendations without good reason for each change.

Maybe SQLite.swift could adapt to the features available in the SQLite library it's using?

@marcprux
Copy link
Copy Markdown
Author

marcprux commented Jan 7, 2025

Maybe SQLite.swift could adapt to the features available in the SQLite library it's using?

I can look into this, but some of the options like SQLITE_THREADSAFE=0 would be non-starters.:

For example, the SQLITE_THREADSAFE=0 option is only usable by applications that never access SQLite from more than one thread at a time.

I can look into debugging the issue with the other options, but if SQLITE_THREADSAFE needs to be set to 0, then I don't think it will be usable.

@sbooth
Copy link
Copy Markdown
Owner

sbooth commented Jan 15, 2025

I imagine that SQLITE_THREADSAFE is one of the more frequently-discussed preprocessor flags. With GCD queues and Swift actors it seems that there are other synchronization methods available which is why I set SQLITE_THREADSAFE=0 for this package. This is another case where I really wish SPM had package features to allow a bit of customization.

Could you split this PR in two parts, one for Android support and one for SQLite.swift support, so I can more easily review what support for each entails?

@sbooth
Copy link
Copy Markdown
Owner

sbooth commented May 21, 2025

I think the bulk of this is obsoleted by #65

@sbooth sbooth closed this May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants