Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Error Installing Sqlite3

It seems that I can't install sqlite3 after installing blunder. The ruby version is:

$ ruby -v ruby 2.1.8p440 (2015-12-16 revision 53160) [x64-mingw32]

when i run this command, this log appears:

gem install sqlite3 ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension.

C:/Ruby21-x64/bin/ruby.exe extconf.rb
checking for sqlite3.h... no sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: 
--with-opt-dir 
--without-opt-dir 
--with-opt-include 
--without-opt-include=${opt-dir}/include 
--with-opt-lib 
--without-opt-lib=${opt-dir}/lib 
--with-make-prog 
--without-make-prog 
--srcdir=. 
--curdir 
--ruby=C:/Ruby21-x64/bin/ruby 
--with-sqlite3-dir 
--without-sqlite3-dir 
--with-sqlite3-include 
--without-sqlite3-include=${sqlite3-dir}/include 
--with-sqlite3-lib -
-without-sqlite3-lib=${sqlite3-dir}/lib

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.11 for inspection. Results logged to C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/sqlite3-1.3.11/gem_make.out Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while...

How can I get this installed? This is on a Windows PC

4 Answers

Kevin Korte
Kevin Korte
28,149 Points

You'll need to install sqlite3 first, into your PATH.

Fortunately, sqlite provides precompiled binaries for windows, so head over to their download page http://www.sqlite.org/download.html and you'll need to download either the 32 or (likely) 64 bit ddl zip folder, as well as the sqlite tools zip folder, unpack the zip folders in your C:\WINDOWS\system32, and than try installing the sqlite3 ruby gem again.

  • BUT -

I will warn you, that developing can be difficult on a windows machine. The OS is different than the others. Immo's response should have worked on a Linux or Unix machine, you can see how much easier that is, than what you now have to do on your windows machine. I gave up trying to maintain a reliable development envirnoment in windows, it seem like any time a even a simple patch update happened, stuff stopped working together and I spent 4 hours trying to get ruby to talk to the database again, or this stop this gem from now error, etc.

  • SO-

What's a person on windows to do. My recommendation is to use a free account over at Cloud 9. On Cloud 9 you can get a preconfigured Ruby environment, that will come with sqlite3 working out of the box, no configuration on your part. Cloud 9 will set up a virtual Linux box for you to develop in so you can follow Linux install instructions and install other dependencies in your Cloud 9 box as needed, using the sudo command. You spend 90% developing, 10% setting up with cloud 9, and because it runs in your browser, it doesn't matter that you're on windows, since you're technically developing in a virtual Linux machine.

Some other cool things about Cloud 9, is the preview URL is a live url, so you can also view what your site looks like on any mobile device, and any time, as if it were live. And since the code and site live on Cloud 9, you can work on multiple computers, since you just log in on the other computer, and everything is just how you left it.

Knowing how to set up and maintain environments is important, but so is not getting so frustrated you just end up quitting.

Immo Struchholz
Immo Struchholz
10,515 Points

Try running these commands first:

sudo apt-get install ruby-dev
sudo apt-get install sqlite3-dev

then run

gem install sqlite3

again.

Tried that and I get the following

'sudo' is not recognized as an internal or external command, 
operable program or batch file.

Anything else I should try?

Immo Struchholz
Immo Struchholz
10,515 Points

My bad, for some reason I thought you were on linux.

Kevin, Thanks so much for your help and tips. I'll give Cloud9 a try.

I have a macbook at home that I used most of the time, but try to squeeze in a few Treehouse videos during my lunch break so that's why I needed help with the Windows installation.

Thanks again for your help!