Monday, June 11, 2012

Ruby: Fix for "timeout.rb:60: [BUG] Segmentation fault"

After upgrading my laptop from Fedora 16 to Fedora 17, I hit a big problem while working in Ruby. Since Fedora changed from Ruby 1.8.7 to Ruby 1.9.3 I've decided to work more with RVM so that I can continue to develop across versions.


One of the tasks I'm working on requires developing native extensions. So for Ruby 1.8.7 I needed to install the various rake, rake-compiler, rspec and other gems for use under RVM. But when I tried to install them I had this error come up consistently:

mcpierce@mcpierce-laptop:ruby (Different-Runner-model) $ gem install rake
/home/mcpierce/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault
ruby 1.8.7 (2012-06-10 patchlevel 368) [x86_64-linux]


I needed to reinstall Ruby 1.8.7 under RVM with the following compiler flags:

mcpierce@mcpierce-laptop:ruby (Different-Runner-model) $ CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rvm install 1.8.7
Installing Ruby from source to: /home/mcpierce/.rvm/rubies/ruby-1.8.7-p358, this may take a while depending on your cpu(s)...

ruby-1.8.7-p358 - #fetching 
ruby-1.8.7-p358 - #extracting ruby-1.8.7-p358 to /home/mcpierce/.rvm/src/ruby-1.8.7-p358
ruby-1.8.7-p358 - #extracted to /home/mcpierce/.rvm/src/ruby-1.8.7-p358
Applying patch 'stdout-rouge-fix' (located at /home/mcpierce/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
Applying patch 'no_sslv2' (located at /home/mcpierce/.rvm/patches/ruby/1.8.7/no_sslv2.diff)
ruby-1.8.7-p358 - #configuring 
ruby-1.8.7-p358 - #compiling 
ruby-1.8.7-p358 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.24 for ruby-1.8.7-p358 ...
Installation of rubygems completed successfully.
ruby-1.8.7-p358 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.8.7-p358 - #importing default gemsets (/home/mcpierce/.rvm/gemsets/)
Install of ruby-1.8.7-p358 - #complete 
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to Ruby 1.9.3-125 which will have all of the latest security patches.

Once I did this then install gems installs worked as expected.

No comments:

Post a Comment