2

If I call:

gem install sqlite3-ruby --v 1.2.3

it works for MRI

but if I call:

jruby -S gem install sqlite3-ruby --v 1.2.3

it says it's trying to build a native extension (for Windows) and fails.

Why are JRuby and MRI different in the way they treat gems?

Chris Collins
  • 3,440
  • 5
  • 27
  • 24

2 Answers2

6

JRuby gems that C code must use FFI. FFI is a pretty new thing and most ruby gems that use C do not use it (actually I'm not aware of any that do).

http://blog.headius.com/2008/10/ffi-for-ruby-now-available.html

Anyway, you dont need this for SQLite3 under jruby - use this:

jruby -S gem install jdbc-sqlite3

or if running rails:

jruby -S gem install activerecord-jdbcsqlite3-adapter
Robert Brown
  • 10,888
  • 7
  • 34
  • 40
  • 1
    Also remember to change the database.yml entry to use the jdbc adapter: development: adapter: jdbcsqlite3 database: db/jdbc-development.sqlite3 pool: 5 timeout: 5000 – kfitzpatrick Jul 06 '09 at 17:28
5

Because anything that is building native extensions is compiling something in C, and I believe that JRuby isn't compatible with these things that have parts written in C although I am not across the technical reasons for this.

nitecoder
  • 5,496
  • 1
  • 28
  • 35