20110930

installing a particular version/platform of a ruby gem

I recently installed the Windows 8 developer preview on my netbook. It runs pretty nice, but one important thing is that the development tools I installed are Visual Studio 11. This means that pre-built libraries built with earlier versions or toolchains may not link properly with libraries built with this version.

Consequently, I often needed to have rubygems I installed built from source instead of installing some native version.

I’ll pick on DevIL for a moment. If you search for the gem you’ll find:

>gem search --remote devil



*** REMOTE GEMS ***

devil (0.1.9.5 ruby i386-mingw32 i386-mswin32, 0.1.9.1 x86-mswin32-60)

now if you simply do gem install devil, you’ll get one of the pre-built mswin32 versions--not what I want. In fact, I did try them, and they don’t work, because they dllimport the wrong version of my ruby dll (which, again, I built myself).

Here’s what I did. I found out my ruby version:

>ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mswin32_110]

Then I installed the gem with these flags:

gem install --platform i386-mswin32_110 -v ruby devil

specifying the "ruby" version forced it to build from source. useful

0 comments:

Post a Comment