Bug Bus Error Ruby 1.8.7

BUG Bus Error ruby 1.8.7

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.

sqlite3-ruby can't make on rvm 1.8.7

I got help at Railsconf from a (the?) sqlite3-ruby gem maintainer, Aaron Patterson

Options:

  • Get on Snow Leopard
  • Install sqlite3-ruby 1.2.5
  • Install sqlite3 via macports first

Get on Snow Leopard

sqlite3-ruby >= 1.3.0 not tested for OSX 10.5. Snow Leopard should work

Install sqlite3-ruby 1.2.5

gem install sqlite3-ruby -v 1.2.5

Then set each Rails3 Gemfile to say this

gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

Install sqlite3 via macports first

sudo port install sqlite3
gem install sqlite3-ruby

Nokogiri Segmentation fault?

You are forcing the Apple-installed Ruby to run, which is Ruby 1.8.7:

#!/usr/bin/ruby -w

instead of one of your Rubies managed by RVM. Try:

#!/usr/bin/env ruby -w

That way, if you want your system Ruby to run the code, you can tell RVM to switch to it:

rvm use system

and it will respond with: Now using system ruby. Alternately, you can use any of the RVM managed Rubies to run the code:

rvm 1.8.7

if you had RVM install an instance of 1.8.7, or

rvm 1.9.2

or

rvm default

if you set up a default Ruby for RVM, which is always a good idea:

rvm use 1.9.2 --default

You can check to see what versions of Ruby RVM has under its control:

$ rvm list

rvm rubies

ruby-1.8.7-p334 [ x86_64 ]
=> ruby-1.9.2-p180 [ x86_64 ]

Now, moving to your actual code, you have a bug. When trying to retrieve the price for an item you're looking for the wrong CSS, not finding the price node, getting a nil value, then trying to get the text from it. Use this instead:

price = item.at_css(".camelPrice").text[/\$[0-9\.]+/]

Your output will look similar to:


Fisher-Price Power Wheels Batman Lil Quad Ride-On
- $59.97
/ip/Fisher-Price-Batman-Lil-Quad/10098697

After making the change to the #! line, and the fix to the price line, I ran your code using Ruby 1.8.7 in my system, along with RVM controlled 1.8.7 and 1.9.2 with no problems.

RVM won't install ruby - I even downgraded to XCode 4.1 - Error pertains to readline

in short, the solution is this:

rvm pkg install readline

rvm reinstall 1.8.7

rvm reinstall 1.8.7 --with-readline-dir=$rvm_path/usr

Why is Ruby throwing a Segmentation fault on only my system, and only in this Rails application?

Ok, I've fixed this on my machine. I'm not sure exactly why, but downgrading the ruby-debug gem to version 0.10.0 solves the problem for me.

The specific fix is running the following commands:

sudo gem uninstall ruby-debug

sudo gem install ruby-debug --version 0.10.0


Related Topics



Leave a reply



Submit