Linux Support
SQLite.swift is compatible with Linux, allowing you to use it in server-side Swift applications. However, there are some limitations to be aware of.
Limitations
- Custom Functions/Aggregations: Creating custom SQL functions and aggregations is currently not supported and may cause a crash. This is due to an underlying bug in the Swift runtime on Linux. See issue #1071 for more details.
Development and Debugging on Linux
If you are contributing to SQLite.swift or debugging an issue on Linux, a Docker container provides a consistent environment.
1. Create and Launch Docker Container
First, pull a Swift-enabled Docker image and run a container. The flags below are important for enabling debugging tools like LLDB.
# Create a container from a Swift image (e.g., focal)
docker container create swift:focal
# Run the container in interactive mode with debugging permissions
docker run --cap-add=SYS_PTRACE \
--security-opt secomp=unconfined \
--security-opt apparmor=unconfined \
-i -t swift:focal bash
2. Compile and Run Tests
Inside the container, you can clone the repository and run the test suite.
# Install the SQLite3 development library
apt-get update && apt-get install -y libsqlite3-dev
# Clone the repository
git clone https://github.com/stephencelis/SQLite.swift.git
cd SQLite.swift
# Run the tests
swift test
3. Debugging with LLDB
To debug the test suite with LLDB:
# Launch LLDB with the test executable
lldb .build/x86_64-unknown-linux-gnu/debug/SQLite.swiftPackageTests.xctest
# Inside LLDB
(lldb) target create ".build/x86_64-unknown-linux-gnu/debug/SQLite.swiftPackageTests.xctest"
(lldb) run