Ruby on Rails Console Seg Faults - ruby-on-rails

I have been going through a Ruby on Rails tutorial and have been succeeding up until this point. I simply try to run the rails console:
rails console
and I get this message:
/home/george/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.so: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Obviously, I have tried other solutions on StackOverflow, including
sqlite3_native.so: [BUG] Segmentation fault
and Rails s return: [BUG] Segmentation fault
and have tried the various solutions, such as completely reinstalling the bundles and gems, and removing and reinstalling different versions of sqlite3, none of which have had any effect.
I'm just looking for suggestions or things I'm missing as a newbie to both Ruby and Rails.
[Edit/Solution] Sometimes I worry about my own intelligence. All of my problems were solved by using RVM to switch to 1.9.3-p448 and setting this is as default.

The first thing that jumps out at me is it is trying to load a Ruby 1.9.3 version of the nokogiri library in a Ruby 1.8.7 environment. This would most likely be compiled against all sorts of things that conflict with Ruby 1.8.7 (different versions of libxml2, etc). If I were you, I would nuke 1.8.7 from your machine entirely, and focus on getting a totally sane RVM environment running 1.9.3, since it seems that is what you are actually trying to accomplish anyways.
This probably has to do with the GEM_LOAD_PATH conflicting between the 2 different versions of ruby. Nuking one or the other is probably your best bet.

Related

Segmentation fault comes and goes

I have two rails projects on my machine. If I go directly to one of the apps and run the rails s, I get a seg fault error (below).
.rvm/gems/ruby-1.9.3-p194/gems/bcrypt-ruby-3.0.1/lib/bcrypt_ext.bundle: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
However if I run the other project first, then run this project, the problem goes away and the server boots up. Anyone know why this would happen or have any ideas that I could try?
I have a feeling it has to do with bundler and potentially rvm with managing gems?
It says it is a bug, and you are using an outdated patchlevel from ruby.
Try to update to the latest patch level (I believe ruby-1.9.3-p429), and if it persists and you really trust your hardware, you will have to open a bug for ruby.
Could be computer memory issue too, I suppose it is better try your code in other box, just to be sure.

Ruby Version 1.9.3p392 Causing Errors with gem 'monbon'

The Ruby Version set on my windows machine is:
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
I have tried running the ruby installer for Ruby 2.0.0 but cannot seem to get it to replace the 1.9.3p392.
Now I am working in a tutorial that requires the gem 'monbon' - but when I run bundle on a new app, I get the message:
Could not find gem 'monbon' (= 0.0.6) x86-mingw32' in the gems available on this machine.
Is the patch on the Ruby causing this error and why?
What are some steps I can take to just run Ruby 1.9.3 or 2.0.0?
Any further code or screen shots I can take to help diagnose issue?
EDIT TO ADD SOLUTION:
I was able to install Pik
(https://github.com/vertiginous/pik)
by following this tutorial
(http://puneetpandey.com/tag/how-to-install-and-configure-pik-on-windows/)
and solving an error by this stack overflow questions (installing pik in system path in windows)
Then I installed Ruby 2.0.0 and also the exact Ruby version and patch from the tutorial using Pik.
Firstly, this 'strange patch' is perfectly normal and expected. It tells you the patchlevel that has been applied to your ruby 1.9.3 installation. And patches are good - they generally are used to fix security and stability issues.
Secondly, the [i386-mingw32] is there to let you know that you are using the Windows flavor (or 'i386-mingw32' flavor to be more correct) of ruby. This is important, because not all gems necessarily support all OS's without some tweaking. Many of them need to be compiled, and the instructions for doing so can differ from OS to OS. Now on to your list:
The strange patch is not causing the error.
The steps you can take to run the correct Ruby are - install pik. It lets you choose the right version of ruby whenever you want. And it lets you set the default version when you don't want to think about it.
Nothing to diagnose, everything is running as expected. The gem can't be found for the i386-mingw32 ruby flavor. Check with your 'monbon' gem author to see if and how this can be resolved.

Rails Server won't start after Ruby upgrade - Segmentation Fault

After upgrading my Ruby to 1.9.3-p429, I tried to start the Rails server. It told me rails was not installed so, I boldly did a 'gem install rails'. Now when I try to start the server, I'm getting this:
andrunix#amp-laptop~/code/madrilla$ rails s
/Users/andrunix/.rvm/gems/ruby-1.9.3-p429/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Abort trap: 6
I have no idea why that says, "ruby 1.8.7" in that output. Perhaps that's a clue to my problem.
But anyway, super frustrated at this point.
And by the way, this is on OS X.
Help me please!
Try to set the version you've installed as the default for your whole system:
rvm --default use ruby-1.9.3-p429

Looking For Steps In Migrating Ruby 1.8.7 Web Application To Ruby 1.9.3

I am having an big old ruby on rails application
ruby version - 1.8.7 (2011-06-30 patchlevel 352)
rails version - 2.3.16
currently there is no plan in migrating rails version
As far as i know the performance of ruby 1.9.x is 2 times faster than 1.8.7
Questions:
1) I would like to know whether rails 2.3.16 is fully compatible with ruby 1.9.3-p385 ?
2) I am looking for basic generic steps in only migrating ruby 1.8.7 to ruby 1.9.3 without upgrading rails 2.3.x to rails 3.xx
3) And i would like to know the migration complexity level and issues?
Note:
I am looking for answers, suggestions, comments and reviews from those who really involved in ruby app migration from 1.8.7 to 1.9.3 by sticking with rails 2.3.x
I found this migration guide, maybe it'll give you answers. http://developer.uservoice.com/blog/2012/03/04/how-to-upgrade-a-rails-2-3-app-to-ruby-1-9-3/
From what I read, it can be quite a pain in the ass, since rails 2.3 does not support ruby 1.9.
If you can do it, I'd suggest migrating your rails anyway, at least 3.0 (before the asset pipeline) : it will still be a pain in the ass (as with any big migrations), but there are tools like rails_upgrade meant to facilitate this process.
Update a Rails application to the latest Ruby version with Rbenv.

Rails Starting Up With Wrong Version of Ruby

TLDR: How do I force a rails app to use the correct ruby interpreter?
Hello,
Something hosed parts of my Ruby 1.9.2p290 install (certain classes just went missing one day), so I removed it and attempted to reinstall the environment.
I'm running on Snow Leopard.
Ruby 1.9.2 was installed from source. (I tried to install via MacPorts and it would fail). I am not keen on RVM as I use bundler and I seem to recall some problems with how bundler and RVM interact, though from what I can tell RVM works.
After reinstalling a few gems I noticed they were being placed in a gem folder for Ruby 1.8. "This is weird," I thought.
Starting up the rails app, I notice a lot of weird exceptions being thrown regarding syntax. After printing RUBY_VERSION to stdout, I noticed that the Rails app is running 1.8.7.
which ruby shows only one ruby interpreter:
$ which ruby
/usr/bin/ruby
$ /usr/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
If I open up Activity Monitor, the ruby process from the Rails app lives at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby, which I believe is the ruby interpreter that OSX shipped with.
I haven't found any information on completely purging Ruby from OSX. I would love to do that then simply install ruby from source.
It seems there are two problems:
Rails is running a ruby interpreter that I have no idea how it is calling, when I need it to run the 1.9.2 interpreter installed from source
gems are being installed in a 1.8 folder, I suspect because gem thinks its running under 1.8
How do I fix this?
Thank you,
Tom
I guess the best way to overcome this issue is using rvm to handle your Ruby and Rails environments through 'gemset's.
I had the same issue and I use gemsets now without a problem.
This is the article which I got things working:
http://stjhimy.com/posts/10-five-quick-steps-to-set-up-rvm-with-rails-2-and-rails3

Resources