4
votes

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

2
Have you seen this stackoverflow.com/questions/15480381/…? especially step #9 in the first answerUri Agassi
@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

2 Answers

1
votes

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.

1
votes

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