SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

Problem with CSQLite

Open freefelt opened this issue 1 year ago • 1 comments

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

freefelt avatar Feb 26 '24 19:02 freefelt

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.

JohnWickham avatar Apr 24 '24 20:04 JohnWickham