Saturday, April 7, 2012

Ruby and Xcode 4.2

This weekend I didn't have anything better to do, so I decided to play with ruby-opengl.

My platform (for the machine in question) is OS X Lion, and my tool chain is from a full install of Xcode 4.2. Unfortunately "gem install ruby-opengl" resulted in a veritable cornucopia of error messages which flowed tauntingly over my screen. $#!$@#@!

It turns out this is for good reason. Here is what rvm has to say about my setup:

Xcode 4.2:
* is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
* it breaks gems with native extensions, especially DB drivers.

Hmm, that doesn't sound good. Here I was thinking that rvm more or less kept things sane, but it looks like there is a little too much dark magic going on under the covers (something true a little bit too often when it comes to Ruby methinks). So I'm trying out an alternative, rbenv, which purports to abstract versions and such through directories and the path variable.

So after staring into the void for at least an hour too long, I managed to conjure up a MRI Ruby 1.8.7 release, like so (this is *after* uninstalling rvm):

Install (using home brew) apple-gcc42:
brew update
brew tap homebrew/homebrew-dupes
brew install apple-gcc42

Install rbenv:
brew install rbenv
brew install ruby-build

Install ruby-1.8.7-p352:
rbenv install 1.8.7-p352

Tell rbenv to make the installed Ruby interpreter the default, per user global:
rbenv global 1.8.7-p352

Install the ruby-opengl gem:
gem install ruby-opengl


No comments:

Post a Comment