Announcing swift-toolchain-sqlite

Announcing swift-toolchain-sqlite!

Both SwiftPM and llbuild depend on SQLite. This adds to our list of dependencies you need when building your own toolchain, or building these components as packages.

On Apple platforms, sqlite is provided by the system SDK, and on Linux, it is easily provided by the system package manager (sqlite-devel on RPM distros, and libsqlite3-dev on Debian distros).

However, for other platforms such as Windows and WebAssembly (and perhaps static Swift on Linux), there is no SQLite package provided by the system by default.

If you want to build the Swift toolchain, you must first build and install your own copy of SQLite, and if you simply want to build SwiftPM or llbuild using swift-build, you must also pass custom flags, complicating the setup process and making the overall build process less portable.

After reviewing with the Core Team, we are introducing the swift-toolchain-sqlite package to serve as a vehicle to provide SQLite on platforms which need it, which will:

  • Allow building SwiftPM and llbuild using swift-build without non-system dependencies and/or custom flags
  • Allow building Swift toolchains for Windows without a network dependency on downloading SQLite from sqlite.org on demand
  • Allow controlling the version of SQLite in use

This is not meant as a general SQLite package, but rather to assist in contributors building Swift toolchains and components of the Swift toolchain more smoothly across all platforms supported by Swift.

I plan to open PRs against swift-package-manager and swift-llbuild soon to adopt this new package, and am interesting in hearing from @compnerd if we can adopt the new package during the build of the Swift installer for Windows. I think it could also be a first step towards building some of the toolchain components on Windows using SwiftPM rather than CMake, although we'll probably need to add CMake support to the new sqlite package and use that to start with.

12 Likes

For SQLite, this will definitely be a convenience. For the toolchain build, we cannot use SPM to build, but if we continue to inject the CMakeLists.txt, that should be fine and very welcome. This is the only source dependency that we have which cannot be consumed from git. The SPM limitation requires more invasive changes to llbuild and SPM which we were never able to get sorted out to ensure that we have the correct build model for libraries.

I've landed [update-checkout] Add swift-toolchain-sqlite to the list of repos by jakepetroules · Pull Request #75743 · swiftlang/swift · GitHub to get swift-toolchain-sqlite included in the update-checkout script.

I've also landed Add support for building on Windows using SwiftPM by jakepetroules · Pull Request #930 · swiftlang/swift-llbuild · GitHub to add the swift-toolchain-sqlite dependency to llbuild, which allows swift test to pass successfully for llbuild.

Finally, I'm close to landing Add (partial) support for building on Windows using SwiftPM by jakepetroules · Pull Request #7866 · swiftlang/swift-package-manager · GitHub which adds the swift-toolchain-sqlite dependency to swift-package-manager. This almost allows swift build --build-tests to work for SPM, but I can't get past the Windows 65k exported symbol limit due to the library build model issues you mentioned above, and that's something we'll have to address separately.

I don't know if I'll be able to dedicate time to the CMake integration of swift-toolchain-sqlite in the short term, but @compnerd if you or someone else would like to pick that up, it would be appreciated!

As you wish: build: add an initial CMakeLists.txt by compnerd · Pull Request #2 · swiftlang/swift-toolchain-sqlite · GitHub

1 Like