Vapor SQLite Build Error
02 Jul 2022I’ve been playing around with Vapor for server side swift development. Having installed Swift on a Raspberry Pi and followed the Getting Started guide to install Vapor and great a basic project, with SQLite support, I got the following compile errors running swift run
.
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "csqlite.h"
^
/home/pi/src/myapi/.build/checkouts/sqlite-nio/Sources/CSQLite/csqlite.h:4:10: error: 'sqlite3.h' file not found
#include <sqlite3.h>
^
/home/pi/src/myapi/.build/checkouts/sqlite-nio/Sources/SQLiteNIO/SQLiteConnection.swift:2:8: error: could not build C module 'CSQLite'
import CSQLite
The solution was to install the missing libsqlite3-dev library.
$ sudo apt install libsqlite3-dev