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

bundler, gcc, linux, ruby, rvm

Solution

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

Problem

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)

Original source