Solving some gem install problems

Posted by Andre Foeken Sun, 29 Jul 2007 16:08:14 GMT

Lately we have been having some issues installing gem that have to compile native extensions like libxml-ruby and termios.

The error we got from libxml was: "extconf failure: need libm". Strangely this was all caused by incorrect compile flags in the rbconfig.rb file.

To fix this (and other issues) you can customize the rbconfig.rb file to your specific computer.

Mine was located in:

 /usr/lib/ruby/1.8/universal-darwin8.0/rbconfig.rb

On leopard this is universal-darwin9.0. The file contains a lot of config definitions. I removed all traces of any other architecture then i386 (like -arch x86_64, etc). I also removed the 64 flag that was included.

After altering this in the entire file (quite a few replaces), everything compiled happily.

update

I was also having some issues with the SQLSessionStore plugin. Seems recent changes to ruby have made it a no-no to alter constants (no surprise there). So now in stead of doing

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS. update(:database_manager => SqlSessionStore)

You have to do:

dso = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS dso[:database_manager] = SqlSessionStore ActionController::CgiRequest.send(:remove_const, "DEFAULT_SESSION_OPTIONS") ActionController::CgiRequest.const_set("DEFAULT_SESSION_OPTIONS", dso)

Which is uglier, and still should not be possible :)

To make it work I also had to remove the require 'mysql' line from the plugins MySqlSession.rb file. Else it would crash rails with the following error:

warning: already initialized constant OPTIONS

Posted in ,  | Tags , , , , , , , , , , ,  | no comments