Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install bundler using rvm, ruby 1.8.7 with gcc 4.7 on linux

Issues building ruby 1.8.7 or installing the bundler gem with GCC 4.7 on linux (Fedora 17, Arch, etc.). This issue occurred for me using RVM. I was able to install 1.8.7, but unable to install the bundler gem. I would receive the following error:

$ gem install bundler

~/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]

this issue is described in a number of locations, including:

  • ruby-enterprise 1.8.7-12: timeout.rb:60: [BUG] Segmentation fault
  • Ruby gem install is seg faulting
  • rvm install rbx fails on archlinux (mri 1.8 + gcc 4.7 issue)
  • ruby1.8: segfaults when compiled with gcc-4.7
  • Ruby 1.8.7 fails to build (Arch Linux, gcc > 4.6)
like image 340
Patrick Klingemann Avatar asked May 30 '12 16:05

Patrick Klingemann


2 Answers

The description of the problem in the links in the original question suggest installing older versions of gcc to build 1.8.7, this is not necessary.

$ rvm remove 1.8.7
$ CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rvm install 1.8.7
$ rvm use 1.8.7
$ gem install bundler

Solution derived from the following:

Bug #6383: Segfault in Timeout module when compiled with GCC 4.7

like image 117
Patrick Klingemann Avatar answered Sep 20 '22 18:09

Patrick Klingemann


Also, I would ensure that you have the stable release that was released as of today, May 30, 2012 which is 4.7.0 and NOT one of the previous 4.7 releases which were not stable releases. RVM has a policy of not supporting non-stable-releases (aka development versions) of GCC for the reason that, well we're not compiler guys hehe.

Then, in addition, please uninstall and reinstall your original version of 1.8.7. Another option is to 'rvm reinstall 1.8.7' though not all previous configure options may be regenerated to include acceptance of the changed CFLAGS variable, as written to the config. @mpapis, do we need to advocate use of the --autoconf --force here?

(mpapis and I are devs on the RVM Project so this is as good a place as any to discuss flags and monitor to see which should be done so we can push the info to anyone else that comes to us about this)

like image 39
ddd Avatar answered Sep 18 '22 18:09

ddd