Compile SQLite to a Shared Library

#codesnippet #shell #sqlite

Steps

  1. Download the the amalgamation (sqlite.c) from https://sqlite.org/download.html

  2. Run the below command. Consider using compiler flags to enable certain features

CC -dynamiclib sqlite3.c -o libsqlite3.0.dylib -lm -lpthread

Cross Compiling

Leverage Zig's builtin LLVM bundle to compile to any target.

export CC=zig cc -target aarch64-linux-musl