Hi Luis,
I've followed your replies here and also on -core and you seem to be
very knowledgeable about Ruby. One thing I noticed about many (mostly
Windows) related questions from user was that they would happen to mix
different binary Ruby versions; accidentally.
Is there no mechanism for gems to depend on specific Ruby version and
arch-types for binaries (sometimes even sources) ?
I've covered this case back in April 2009 on rubygems-devel list:
http://rubyforge.org/pipermail/rubygems-developers/2009-April/004522.html
You can define a gem to be targeted at one version of Ruby (using gem
spec required_ruby_version attribute), however, you can't generate a
binary gem that target both 1.8.x and 1.9.x series of Ruby.
There are binary differences between 1.8.x and 1.9.x (different C-API,
different VM, etc) that made these pre-compiled extensions
incompatible.
Aaron Patterson came up with a nice idea called fat-binaries -- the
analogy to universal binaries of OSX -- which provides, under the same
gem binaries for both 1.8 and 1.9 versions of Ruby.
You can see examples of that in binary gems like sqlite3-ruby, mysql,
a series of DataMapper (DO) adapters and Nokogiri itself.
The above mentioned libraries rely on rake-compiler as helper to ease
both the binary gems generation and the fat-binary packaging.
But not all gem developers actually know about this and some of them
don't actually care about Windows binaries due it's complexities.
There are some gems that do not depend on external libraries (e.g.
rdiscount, RedCloth, BlueCloth and others) that only needs a compiler
to build its extension.
For those cases you can use RubyInstaller + DevKit and force the
platform during the gem installation:
gem install rdiscount --platform=ruby
That will trigger the compilation process and you're 100% sure, if it
succeed in the compilation, that the binaries are going to work with
your current version of Ruby.
You can read instructions on installation of these elements in our
wiki:
http://github.com/oneclick/rubyinstaller/wiki/Development-Kit
For the cases that depend on external libraries (mysql, sqlite3-ruby)
you will need to have available the same requirements for a Unix
system: headers and linking libraries available.
That means sometimes just indicate options during the gem
installation:
gem install mysql -- --with-mysql-include=C:/MySQL/include --with-
mysql-lib=C:/MySQL/lib/opt
And others steps required are more depending on the complexity of the
library you're installing.
But, is always better to politely ask the gem author to look into
these issues and also advise him to reach out RubyInstaller group for
assistance in providing these fat-binary gems.