Skip to content

Instantly share code, notes, and snippets.

@jclosure
Created September 4, 2015 04:47
Show Gist options
  • Save jclosure/6c121ef244e7c0c2ec5f to your computer and use it in GitHub Desktop.
Save jclosure/6c121ef244e7c0c2ec5f to your computer and use it in GitHub Desktop.
How to compile sqlite3 in windows and install gem
1. Download the SQLite source amalgamation from
http://sqlite.org/download.html
2. unpack the source in a directory of your choice (e.g. C:\sqlite3)
3. be sure to have the Ruby DevKit installed and enabled the DevKit
environment
4. compile the DLL, I used following command:
gcc -Os -O2 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE
-DSQLITE_ENABLE_COLUMN_METADATA --shared sqlite3.c -o sqlite3.dll
5. copy the DLL to a directory in your PATH, I copied it to
C:\Ruby22\bin
6. install the gem with following command:
gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:/sqlite3
--with-sqlite3-lib=C:/sqlite3
7. Done ;-)
I also compiled the sqlite3.exe with the command:
gcc -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Os -O2
-DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE
-DSQLITE_ENABLE_COLUMN_METADATA shell.c sqlite3.c -o sqlite3.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment