Ruby 2.2.1 and Windows

Downloaded RubyInstaller for Windows Ruby 2.2.1 and was amazed.

Where in the past simple gem installation had failed now it worked.

Is this a change in Ruby, the RubyInsaller for Windows, or RubyGems?

: ruby 2.2.1p85 (2015-02-26 revision 49769) [i386-mingw32]

C:\Users\Scott>gem list

*** LOCAL GEMS ***

bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
test-unit (3.0.8)

C:\Users\Scott>gem install sqlite3
Fetching: sqlite3-1.3.10-x86-mingw32.gem (100%)
Successfully installed sqlite3-1.3.10-x86-mingw32
Parsing documentation for sqlite3-1.3.10-x86-mingw32
Installing ri documentation for sqlite3-1.3.10-x86-mingw32
Done installing documentation for sqlite3 after 1 seconds
1 gem installed

C:\Users\Scott>gem list --local

*** LOCAL GEMS ***

bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
sqlite3 (1.3.10 x86-mingw32)
test-unit (3.0.8)

C:\Users\Scott>gem install sinatra
Fetching: rack-1.6.0.gem (100%)
Successfully installed rack-1.6.0
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: rack-protection-1.5.3.gem (100%)
Successfully installed rack-protection-1.5.3
Fetching: sinatra-1.4.5.gem (100%)
Successfully installed sinatra-1.4.5
Parsing documentation for rack-1.6.0
Installing ri documentation for rack-1.6.0
Parsing documentation for tilt-1.4.1
Installing ri documentation for tilt-1.4.1
Parsing documentation for rack-protection-1.5.3
Installing ri documentation for rack-protection-1.5.3
Parsing documentation for sinatra-1.4.5
Installing ri documentation for sinatra-1.4.5
Done installing documentation for rack, tilt, rack-protection, sinatra
after 731
seconds
4 gems installed

But my joy was short-lived:

C:\Users\Scott>irb
irb(main):001:0> require ‘sqlite3’
LoadError: cannot load such file – sqlite3/sqlite3_native
from
C:/ruby2.2.1-p85/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb
:54:in require' from C:/ruby2.2.1-p85/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb :54:inrequire’
from
C:/ruby2.2.1-p85/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw3
2/lib/sqlite3.rb:6:in rescue in <top (required)>' from C:/ruby2.2.1-p85/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw3 2/lib/sqlite3.rb:2:in<top (required)>’
from
C:/ruby2.2.1-p85/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb
:128:in require' from C:/ruby2.2.1-p85/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb :128:inrescue in require’
from
C:/ruby2.2.1-p85/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb
:39:in require' from (irb):1 from C:/ruby2.2.1-p85/bin/irb:11:in
irb(main):002:0>

Any ideas?

I had the same problem and decided to compile the extension myself. In
the end it turned out to be quite easy:

  1. Download the SQLite source amalgamation from
    SQLite Download Page
  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

  1. copy the DLL to a directory in your PATH, I copied it to
    C:\Ruby22\bin

  2. install the gem with following command:

gem install sqlite3 --platform=ruby – --with-sqlite3-include=C:/sqlite3
–with-sqlite3-lib=C:/sqlite3

  1. Done :wink:

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

Hello Scott,

after reading
https://groups.google.com/forum/#!msg/sqlite3-ruby/cNqvONJmocU/C0Rdg6ZxhV4J
I think this an issue with the sqlite3 gem. Looks like it doesn’t
include the proper sqlite3_native.so for Ruby 2.2. I think we have to
give Luis a little bit of time to update the gem for 2.2.

Thanks Gunter!

I shall have to try that.

I ended up downloading and extracting the most recent knapsack version
of sqlite and using that, similar to what I did in my earlier post:

https://www.ruby-forum.com/topic/4413168

Running:
Windows 7 Professional with SP1
64-bit Operating System

Based upon the directions at the following link:

Created a knapsack directory.

Downloaded the file sqlite-3.7.15.2-x64-windows.tar.lzma and extracted
in the knapsack directory using:

bsdtar --lzma -xf sqlite-3.7.15.2-x64-windows.tar.lzma

Then ran:

gem install sqlite3 --platform=ruby – --with-opt-dir=C:\knapsack

Of course, 3.7.15 is not the latest version of SQLite, but I guess
beggars can’t be choosers.

I just wish I knew what was going on.

Is this a problem with Ruby? A problem with the gem program? A problem
with the sqlite3 RubyGem?