Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BUG Bus Error ruby 1.8.7

Tags:

ruby

rubygems

I'm getting an error after compiling Ruby 1.8.7 using RVM on Lion 10.7.1 with Xcode 4.2 GM (new MacBook).

It compiles fine but when I try to install any gem I get the following:

gem install bundler
/Users/me/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/timeout.rb:60: [BUG] Bus Error
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.1.0]

Abort trap: 6

Update: In the end I hope to have Xcode 4.2 installed, RVM with Ruby 1.8.7, 1.9.x installed and all working properly.

like image 227
Nate Bird Avatar asked Oct 12 '11 01:10

Nate Bird


4 Answers

Since I had to parse through several of these answers to get things working with XCode 4.2, I thought I'd put it all together:

  1. Install Xcode 4.2
  2. Install the gcc standalone compiler from https://github.com/kennethreitz/osx-gcc-installer (which replaces Xcode)
  3. Add export CC=gcc-4.2 to your ~/.bash_profile or equivalent (don't forget to reload it)
  4. Run rvm implode" then re-install rvm http://beginrescueend.com/

At this point I was able to rvm install ruby-1.8.7 (and ruby-1.9.2), and actually get my gems to install.

like image 171
Alex Dixon Avatar answered Oct 23 '22 14:10

Alex Dixon


So nuking RVM (rvm implode) and reinstalling didn't make any difference. I ended up installing Xcode 4.2 and then installing the GCC compilers after which overrides the Xcode compilers.

Here are the steps for those Googling this.

  1. Install Xcode 4.2.x

  2. Install GCC standalone compilers from https://github.com/kennethreitz/osx-gcc-installer

    Note: Xcode 4.3 beta was recently released. I'm testing if this fixes the compilation issues.

like image 33
Nate Bird Avatar answered Oct 23 '22 14:10

Nate Bird


Multiple articles suggest that Ruby doesn't like being compiled with LLVM being involved. The stopgap measure is to thoroughly remove the RVM install – the linked articles say how – and then recompile Ruby with plain GCC. The real fix will have to come from Apple/LLVM or the Ruby team.

like image 2
millimoose Avatar answered Oct 23 '22 14:10

millimoose


I fix that by

  1. installing Xcode 4.2.x,
  2. adding export CC=gcc into ~/.bash_profile,
  3. Reloading environment (source ~/.bash_profile),
  4. executing rvm install 1.9.3,
  5. executing rvm ruby-1.9.3-rc1,
  6. executing gem update --system and finally
  7. executing gem install bundler

The problem is with Xcode 4.2.x version. If you run rvm get head you will see this message "DO NOT use Xcode Version 4.2.x. It currently fails to build several rubies and gems...".

I don't have solution for ruby v1.8.7.

I hope it helps.

like image 2
xpepermint Avatar answered Oct 23 '22 14:10

xpepermint