4
votes

Trying to upgrade to the latest version of Ruby on Rails. I got ruby and rails installed ok (I think).

C:\Users\benjaminw>ruby --version
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

C:\Users\benjaminw>rails -v
Rails 3.2.13

I'm following an instructional guide out of a Ruby on Rails book but it's a little out of date. The next step says to download the sqlite3 db and extract the the files to the following folder C:/Ruby200/bin

Then run the following command to make sure the db was installed correctly

C:\Users\benjaminw>sqlite3 --version
3.7.16 2013-03-18 11:39:23 66d5f2b76750f3520eb7a495f6247206758f5b90

Here is where the problem arises. When I enter the next command I get an ERROR and it seems like it's important to setting up the environment properly. Does anyone know what the following means and how to fix it? Oh and I installed this version of the devkit on my windows 7 computer DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe.

C:\Users\benjaminw>gem install sqlite3-ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

C:/Ruby200/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:/Ruby200/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}/
    --enable-local
    --disable-local


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1
.3.7 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/
gem_make.out
5
Just to add to dr4k3's comment, rails hosting will almost always be on a linux box. So it really is within your interests to develop in unix. Personally at home I use Vagrant for running ruby apps and I use Sublime under windows to do all the code editing. That is by far the best approach that I've found other than switching completely to Mac/Linux.Marklar
try this link this will help you stackoverflow.com/questions/43778/…shrikant1712

5 Answers

2
votes

Running rails in a lousy environment will make things a bigger headache for you. Dependencies will conflict with your only ruby version and make you consider re-installing your OS.

It looks like you are using Windows. I installed rails 3.2 on a fresh Windows 8 computer. After a few days of dealing with config files randomly throughout windows filesystem I grabbed an old laptop installed Ubuntu OS (only because UEFI prevented me from formatting windows 8 and installing ubuntu).

Do yourself a favor! Get an installation of Ubuntu. It makes it way easier to learn Ruby and Rails because the files aren't littered across a mess of windows folders.

To finish, learn about RVM or RBENV. They will make your life better by installing easily and switching versions even easier. There are other benefits that are just to off-topic.

RVM Install <- Personal choice, but I haven't tried RBEnv.

RBEnv on Github

Installing Rails for the first few times is a headache. If you install with one of the above options hopefully it will only be one headache.

2
votes

I absolutely have had no problems with Ruby 2.0 and SQLite as a result of compiling SQLITE.h

Solution

Go the following URL to have this issue squared away by someone who took the next step of compiling the gem over the pre-compiled gems for other Rails 4 Rubyists who wish to use Windows: this link.

With a command like -with-opt-dir=<Path of Sqlite.3 bin, lib, include, and share folders> command. The only tricky part was the files the official sqlite3 website provides are precompiled, which can be extremely hard to consider that being the problem.

I can give you further instructions if you still have any trouble doing such actions towards using Ruby 2.0 and Rails 4.0.0.0beta1.

Using Ruby 2.0 with Windows should be perfectly fine for you now regarding Sqlite3 and Rails. Do note to avoid Ruby 2.0 64-bit when it comes to Rails 4.0.0beta1 because one of the dependent gems for Rails 4 flags incorrectly that the cpu of your computer is not compatible with its gem requirements; that's being resolved soon.

Edit: Noticed I wasn't as helpful as I should have with more explicit instructions; Have provided you a link by someone who's already taken the time to do so and the files needed to get up and running.

@Brian Petro : Actually, solving this issue is easy if you know how Gems and .h files at the end of the day works sometimes with the construction of them. The issue is rooted from how some gems are handled with Ruby 2.0; starting with Ruby 2.0 precompiled gems that were convenient for previous versions of Ruby won't work if they have ABI Breakage; Sqlite3 gem is one of them:

1
votes

Did you see the topic in the rubyinstaller google group, New Knapsack package: sqlite (experimental), you can use the new package and install the gem.

I can success install the gem, you can refer to the following topic:

SQLite3 Ruby 2.0 on Windows

My environment:

  1. OS: win 7 64bit
  2. Ruby: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
  3. Gem: 2.0.5
0
votes

Have you tried http://railsinstaller.org/? From their site: "RailsInstaller has everything you need to hit the ground running. In one easy-to-use installer, you get all the common packages needed for a full Rails stack. Download it now and be writing (and running) Rails code in no time." Looks like it includes sqlite.

0
votes

This link will help.

First install libsqlite3-dev then try sqlite3 using gem.

Use package manager for libsqlite3-dev

and

sudo gem install sqlite3