Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native Ruby module gives error "The specified module could not be found." which is not true

Tags:

sqlite

ruby

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

like image 849
Hubro Avatar asked Oct 31 '22 20:10

Hubro


1 Answers

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

like image 100
Laszlo Avatar answered Nov 15 '22 04:11

Laszlo