Skip to content

Allow linking the system SQLite on Linux - #6

Merged
colemancda merged 21 commits into
masterfrom
feature/linux-system-sqlite
Jul 28, 2026
Merged

Allow linking the system SQLite on Linux#6
colemancda merged 21 commits into
masterfrom
feature/linux-system-sqlite

Conversation

@colemancda

@colemancda colemancda commented Jul 28, 2026

Copy link
Copy Markdown
Member

Allow Linux to link the system SQLite instead of the embedded swift-sqlcipher build.

Changes

  • Add a CSQLite system library target (Sources/CSQLite) that wraps <sqlite3.h> and links sqlite3, declared with pkgConfig: "sqlite3" and apt/yum providers.
  • SWIFT_BUILD_SYSTEM_SQLITE=1 opts Linux into it. The target is only declared in that case, so a default build never performs a pkg-config lookup.
  • The Linux branch of the import chain changed from SwiftToolchainCSQLite to CSQLite. The old module is toolchain-internal (swift-toolchain-sqlite) and not a supported import for package code; this makes the dependency explicit and declared.
  • Add a Linux (system SQLite) CI job that installs libsqlite3-dev and pkg-config and builds with the opt-in set. pkg-config is required by the pkgConfig: declaration, not just the headers.
  • README documents the opt-in.

Defaults

Unchanged. Linux still uses the embedded build, as do Android, Windows, WASI, and OpenBSD; Darwin still links SQLite3.framework. Nothing here is a source break — consumers who don't set the env var see no difference, and the existing Linux CI job still covers that path.

Testing

  • macOS: builds clean, all 124 tests pass.
  • Manifest evaluates in both modes, with CSQLite present in the target list only under SWIFT_BUILD_SYSTEM_SQLITE=1.
  • The Linux side of both modes is what the two Linux CI jobs on this PR will confirm.

Linux previously used the embedded swift-sqlcipher build. It now links the
system libsqlite3 through a system library target declared with pkgConfig
and apt/yum providers. Set SWIFT_BUILD_SQLCIPHER=1 to keep using the
embedded build when the development package is unavailable.
@github-code-quality

github-code-quality Bot commented Jul 28, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Swift

Swift / code-coverage/llvm-cov

The overall coverage in commit 2752e9e in the feature/linux-system... branch remains at 96%, unchanged from commit 19b9b5a in the master branch.


Updated July 28, 2026 18:28 UTC

Linux keeps using the embedded build by default, like the other non-Darwin
platforms. Setting SWIFT_BUILD_SYSTEM_SQLITE=1 declares the CSQLite target
and links the system libsqlite3 instead.
@colemancda colemancda changed the title Use the system SQLite on Linux Allow linking the system SQLite on Linux Jul 28, 2026
@colemancda
colemancda merged commit 507ed30 into master Jul 28, 2026
6 checks passed
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.

1 participant