Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing the SQLite3 gem on Windows: sqlite.h is found, sqlite itself is not

Tags:

sqlite

ruby

I've installed Ruby 2.1 using the RubyInstaller, and I've set up the devkit, which is in my PATH. Other gems with native extensions, like json, work totally fine, and compile normally.

I downloaded the SQLite amalgamation and source code, put it in c:\sqlite3, and added that to my PATH. I now attempt to run gem install sqlite3 --platform=ruby -- --with-sqlite3-dir=C:/sqlite3 --with-sqlite3-include=C:/sqlite3. This fails with the error

checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.

* extconf.rb failed *

sqlite3.exe is downloaded and in my PATH, and I can use SQLite databases from the command prompt just fine. I don't know what else the gem could possibly want from me -- SQLite3.h is there, SQLite is there, it works. No instructions and no StackOverflow posts mention this error, anything else I could do, or extra steps.

like image 832
GreenTriangle Avatar asked Dec 12 '25 21:12

GreenTriangle


1 Answers

I know this is an old question, but I had the same problem and was able to solve it with the following gem install:

gem i sqlite3 --platform=ruby -- --with-sqlite3-dir=C:/Tools/sqlite --with-sqlite3-include=C:/Tools/sqlite --with-sqlite3-lib=C:/Tools/sqlite

I had to add all three of the switches to get it to work. I tried with just

--with-sqlite3-dir=C:/Tools/sqlite

...and then with

--with-sqlite3-dir=C:/Tools/sqlite --with-sqlite-include=C:/Tools/sqlite

but those didn't work. Adding the

--with-sqlite3-lib=C:/Tools/sqlite

...is what did the trick.

like image 131
Jason Fox Avatar answered Dec 14 '25 11:12

Jason Fox