stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.57k stars 1.54k forks source link

Problem with CSQLite #1246

Open freefelt opened 4 months ago

freefelt commented 4 months ago

SQLite.swift 0.15.0 Vapor 4.92.3 Ubuntu 23.10 sqlite3 3.42.0

It works on macOS from Xcode, but does not build in Linux.

root@SpenderBright:~/spenderbright# swift build -c release
warning: 'csqlite': ignoring declared target(s) 'CSQLite' in the system package
Building for production...
/root/spenderbright/.build/checkouts/CSQLite/module.modulemap:2:12: error: header '/usr/include/sqlite3.h' not found
    header "/usr/include/sqlite3.h"
           ^
/root/spenderbright/.build/checkouts/SQLite.swift/Sources/SQLite/Core/Backup.swift:32:8: error: could not build C module 'CSQLite'
import CSQLite
       ^
error: fatalError
[3/871] Compiling SQLite Backup.swift
JohnWickham commented 2 months ago

I can’t explain why SPM is “ignoring declared target(s) 'CSQLite'” when it’s added to the target dependencies for Linux in Package.swift.

The documentation for Linux put me on the right path: install libsqlite3-dev on the Linux machine (or Docker container) you’re building in, then you can swift build or swift test.