problem with Ruby 2.0 gem under Windows 7

4,079 views
Skip to first unread message

Will Parsons

unread,
Oct 26, 2014, 4:42:25 PM10/26/14
to sqlite...@googlegroups.com
I'm trying to run an application using Ruby 2.0 on Windows 7 and am having difficulties.  I installed Ruby 2.0 using RubyInstaller and then ran:

 gem install sqlite3

which apparently succeeded, but when I start the application, I get errors saying "cannot load sqlite3/sqlite3_native".

Googling results in confusing and contradictory information, but some say that the sqlite3.dll has to be in the PATH, so I downloaded the current sqlite3.dll and put it in a directory in the PATH but it makes no difference.  This is not surprising to me since I didn't have it for my previously installed Ruby 1.9.3, which works just fine.  There does seem to be a sqlite3_native.so file under both Ruby 1.9.3 and Ruby 2.0.  Any advice would be appreciated.


Luis Lavena

unread,
Oct 27, 2014, 10:01:25 AM10/27/14
to sqlite...@googlegroups.com
Hello,

On Sunday, October 26, 2014 5:42:25 PM UTC-3, Will Parsons wrote:
I'm trying to run an application using Ruby 2.0 on Windows 7 and am having difficulties.  I installed Ruby 2.0 using RubyInstaller and then ran:

 gem install sqlite3

which apparently succeeded, but when I start the application, I get errors saying "cannot load sqlite3/sqlite3_native".


Will be great if you can provide more details since "start the application" doesn't tell us much. Is a Rails application? is sqlite3 gem part of the Gemfile?

Just to give you an example, I just tested Ruby and sqlite3 gem without issues:

 
Googling results in confusing and contradictory information, but some say that the sqlite3.dll has to be in the PATH, so I downloaded the current sqlite3.dll and put it in a directory in the PATH but it makes no difference.  This is not surprising to me since I didn't have it for my previously installed Ruby 1.9.3, which works just fine.  There does seem to be a sqlite3_native.so file under both Ruby 1.9.3 and Ruby 2.0.  Any advice would be appreciated.


sqlite3 gem on Windows no longer depend on having sqlite3.dll in the PATH, as the gem has bundled SQLite3 since a few versions ago.

Please provide more details on the issue and specific versions of the components in order for us to be able to reproduce the issues you're having.

Thank you
--
Luis Lavena

Will Parsons

unread,
Oct 27, 2014, 5:01:51 PM10/27/14
to sqlite...@googlegroups.com


On Monday, October 27, 2014 10:01:25 AM UTC-4, Luis Lavena wrote:
Hello,

On Sunday, October 26, 2014 5:42:25 PM UTC-3, Will Parsons wrote:
I'm trying to run an application using Ruby 2.0 on Windows 7 and am having difficulties.  I installed Ruby 2.0 using RubyInstaller and then ran:

 gem install sqlite3

which apparently succeeded, but when I start the application, I get errors saying "cannot load sqlite3/sqlite3_native".


Will be great if you can provide more details since "start the application" doesn't tell us much. Is a Rails application? is sqlite3 gem part of the Gemfile?
 
No - it's a desktop application.
 
Just to give you an example, I just tested Ruby and sqlite3 gem without issues:

 
Googling results in confusing and contradictory information, but some say that the sqlite3.dll has to be in the PATH, so I downloaded the current sqlite3.dll and put it in a directory in the PATH but it makes no difference.  This is not surprising to me since I didn't have it for my previously installed Ruby 1.9.3, which works just fine.  There does seem to be a sqlite3_native.so file under both Ruby 1.9.3 and Ruby 2.0.  Any advice would be appreciated.


sqlite3 gem on Windows no longer depend on having sqlite3.dll in the PATH, as the gem has bundled SQLite3 since a few versions ago.

Please provide more details on the issue and specific versions of the components in order for us to be able to reproduce the issues you're having.

OK:

 Welcome to the Emacs shell

~ $ which ruby
c:/Ruby21/bin/ruby.exe
~ $ ruby --version
ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]
~ $ gem --version
2.2.2
~ $ gem list sqlite3
sqlite3 (1.3.9 x86-mingw32)
~ $ irb
DL is deprecated, please use Fiddle
Switch to inspect mode.
require 'sqlite3'
require 'sqlite3'
LoadError: cannot load such file -- sqlite3/sqlite3_native
    from c:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from c:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from c:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
    from c:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
    from c:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from c:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from c:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from (irb):1
    from c:/Ruby21/bin/irb:11:in `<main>'


SQLite3::VERSION
SQLite3::VERSION
NameError: uninitialized constant SQLite3
    from (irb):3
    from c:/Ruby21/bin/irb:11:in `<main>'
SQLite3::SQLITE_VERSION
SQLite3::SQLITE_VERSION
NameError: uninitialized constant SQLite3
    from (irb):4
    from c:/Ruby21/bin/irb:11:in `<main>'

Luis Lavena

unread,
Oct 27, 2014, 6:11:32 PM10/27/14
to sqlite...@googlegroups.com
Hello Will,

Thank you for your response, please see comments below.

On Mon, Oct 27, 2014 at 6:01 PM, Will Parsons <gyli...@gmail.com> wrote:


On Monday, October 27, 2014 10:01:25 AM UTC-4, Luis Lavena wrote:

Please provide more details on the issue and specific versions of the components in order for us to be able to reproduce the issues you're having.

OK:

 Welcome to the Emacs shell

~ $ which ruby
c:/Ruby21/bin/ruby.exe
~ $ ruby --version
ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]

Here is the problem. In your original email you said "Ruby 2.0", which I assumed you meant "Ruby 2.0.0".

As shown in my example, using Ruby 2.0.0 (latest patchlevel) it worked.

But you actually used Ruby 2.1.3, which is known as "Ruby 2.1" (not 2.0), and that, as indicated in RubyInstaller 2.1.3 release notes:


#### Existing pre-compiled gems might not be Ruby 2.1 compatible

Ruby 2.1 introduces ABI breakage which means compiled C extensions with previous
1.9.3 or 2.0.0 will not run against Ruby 2.1.

**DO NOT install Ruby 2.1 on top of existing Ruby 1.9.3 or 2.0.0**, or try to
use compiled extensions with it.

You will be required to force compilation of those gems:

    gem install <name> --platform=ruby

This **will require you have the extra dependencies installed** for that gem to
compile. Look at the gem documentation for the requirements.

Please check each gem documentation and recent releases.

---

SQLite3 gem do not bundle binaries for Ruby 2.1, this has been requested but I have been busy with life, work and personal issues in order to perform a proper release.

At this time I'm working on building newer 1.9.3, 2.0.0 and 2.1.4 in order to fix the CVE security issue recently exposed.

Unless you're forced/required to use Ruby 2.1, I would suggest use Ruby 2.0.0 along the existing binary of sqlite3 until a new release of sqlite3 is made available.

Or you can force compilation of SQLite3 gem by installing RubyInstaller and DevKit, downloading and compiling sqlite3 sources.

(I would recommend the former suggestion)

Regards,
-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Will Parsons

unread,
Oct 28, 2014, 6:03:50 PM10/28/14
to sqlite...@googlegroups.com


On Monday, October 27, 2014 6:11:32 PM UTC-4, Luis Lavena wrote:
Hello Will,

Thank you for your response, please see comments below.

On Mon, Oct 27, 2014 at 6:01 PM, Will Parsons <gyli...@gmail.com> wrote:
On Monday, October 27, 2014 10:01:25 AM UTC-4, Luis Lavena wrote:

Please provide more details on the issue and specific versions of the components in order for us to be able to reproduce the issues you're having.

OK:

 Welcome to the Emacs shell

~ $ which ruby
c:/Ruby21/bin/ruby.exe
~ $ ruby --version
ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]

Here is the problem. In your original email you said "Ruby 2.0", which I assumed you meant "Ruby 2.0.0".

As shown in my example, using Ruby 2.0.0 (latest patchlevel) it worked.

But you actually used Ruby 2.1.3, which is known as "Ruby 2.1" (not 2.0), and that, as indicated in RubyInstaller 2.1.3 release notes:


#### Existing pre-compiled gems might not be Ruby 2.1 compatible

Ruby 2.1 introduces ABI breakage which means compiled C extensions with previous
1.9.3 or 2.0.0 will not run against Ruby 2.1.

Hmm - I guess I wasn't paying enough attention (or being too careless and just automatically using the latest version).

**DO NOT install Ruby 2.1 on top of existing Ruby 1.9.3 or 2.0.0**, or try to
use compiled extensions with it.

You will be required to force compilation of those gems:

    gem install <name> --platform=ruby

This **will require you have the extra dependencies installed** for that gem to
compile. Look at the gem documentation for the requirements.

Please check each gem documentation and recent releases.

---

SQLite3 gem do not bundle binaries for Ruby 2.1, this has been requested but I have been busy with life, work and personal issues in order to perform a proper release.

That happens.  Don't feel bad - I'm grateful for your work on ruby-sqlite3.
 
At this time I'm working on building newer 1.9.3, 2.0.0 and 2.1.4 in order to fix the CVE security issue recently exposed.

Unless you're forced/required to use Ruby 2.1, I would suggest use Ruby 2.0.0 along the existing binary of sqlite3 until a new release of sqlite3 is made available.

I'll do that.  (Right now, I can't seem to be able to download the 2.0.0 version of RubyInstaller, but I'll keep trying.)
 
Or you can force compilation of SQLite3 gem by installing RubyInstaller and DevKit, downloading and compiling sqlite3 sources.

(I would recommend the former suggestion)

Thank you for your help, and I'll try to follow up when I actually succeed in installing Ruby 2.0.0.

--
Will
 

Will Parsons

unread,
Oct 28, 2014, 6:09:33 PM10/28/14
to sqlite...@googlegroups.com

Finally succeeded in installing Ruby 2.0.0 and everything works.  Thanks again for the help!

--
Will

Luis Lavena

unread,
Oct 31, 2014, 10:24:05 AM10/31/14
to sqlite...@googlegroups.com
Hello,

FYI: I've released version 1.3.10 that includes support for Ruby 2.1.x on Windows.

Cheers.

Jason Thomas

unread,
Jun 16, 2015, 1:18:49 PM6/16/15
to sqlite...@googlegroups.com
Thanks Luis, 1.3.10 works great for me on Ruby 2.1. Of course now that we have Ruby 2.2 ...  :-)

It looks like Nokogiri is also still working on Ruby 2.2 support for Windows: https://github.com/sparklemotion/nokogiri/issues/1256. So until then we can't really run Rails anyway which is where I think a lot of the demand for sqlite comes from since it is the default.

I tried downloading the source and performing a build but didn't get very far. For now staying on 2.1 is fine. Thanks for all you do for the Ruby Windows community. We wouldn't be getting very far without you!

Jason
Reply all
Reply to author
Forward
0 new messages