6

I just installed the Ruby gem "sqlite3" for windows with the command

>gem install sqlite3 --platform=ruby -- --with-sqlite3-include=c:/sqlite3/include --with-sqlite3-lib=c:/sqlite3/lib --with-sqlite3-dir=c:/sqlite3/bin

It compiled seemingly perfectly, but when I try to include the gem I get:

irb(main):001:0> require "sqlite3"
LoadError: 126: The specified module could not be found.   - C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3/sqlite3_native.so
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3.rb:6:in `rescue in '
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3.rb:2:in `'
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        from (irb):1
        from C:/Ruby200/bin/irb:12:in `'

So I checked the path it gave for "sqlite3_native.so" and lo and behold, there it was! Just like it's supposed to be. So why is Ruby lying to me? How can I find out the real reason why the gem isn't working?

The reason I'm building the gem manually is that the pre-built gem comes with an outdated SQLite3 version

Hubro
  • 56,214
  • 69
  • 228
  • 381
  • 1
    Have you seen this http://stackoverflow.com/questions/15480381/how-do-i-install-sqlite3-for-ruby-on-windows? especially step #9 in the first answer – Uri Agassi Jul 23 '14 at 16:01
  • @UriAgassi: Rails app? I don't have a rails app. I'm just trying to include sqlite3 using irb. Also, I don't have multiple sqlite3-ruby versions installed, just 1.3.9. – Hubro Jul 23 '14 at 21:01

2 Answers2

2

Having sqlite3.dll and sqlite3.def on the path did not help. Putting it inside of <install path>\Ruby25-x64\bin helped.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Laszlo
  • 302
  • 1
  • 10
1

Basically I found my answer in the HEADS UP portion of this answer.

"sqlite3.dll" and "sqlite3.def" needs to be placed somewhere in PATH. I copied them into "C:\Ruby200\bin" and now I can require "sqlite3" successfully. I must say though, that this is an example of a tremendously unhelpful error message from Ruby.

Community
  • 1
  • 1
Hubro
  • 56,214
  • 69
  • 228
  • 381
  • 2
    I have exactly the same problem as you, except putting the .def and .dll in a folder on my system PATH did not change the error. – Jason Apr 04 '15 at 00:53