delta force
2013-Feb-21 06:05 UTC
[BUG] Segmentation fault ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
I am using Active Record outside rails. I created one rb file at: /usr/share/puppet-dashboard/bin/process.rb Code of process.rb #!/usr/bin/ruby require ''active_record'' ActiveRecord::Base.establish_connection( :adapter => "mysql2", :host => "localhost", :username => "root", :password => "root123", :database => "testproject_development" ) But when i run this rb file then i get the following error:- /usr/local/rvm/gems/ruby-1.9.3-p362@artwork_auto/gems/json-1.7.7/lib/json/ext/parser.so: [BUG] Segmentation fault ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux] Any help will be highly appreciated. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Frederick Cheung
2013-Feb-21 09:22 UTC
Re: [BUG] Segmentation fault ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
> > > Code of process.rb > > #!/usr/bin/ruby > > require ''active_record'' > ActiveRecord::Base.establish_connection( > :adapter => "mysql2", > :host => "localhost", > :username => "root", > :password => "root123", > :database => "testproject_development" > ) > > But when i run this rb file then i get the following error:- > > /usr/local/rvm/gems/ruby-1.9.3-p362@artwork_auto/gems/json-1.7.7/lib/json/ext/parser.so: > > [BUG] Segmentation fault ruby 1.8.7 (2011-06-30 patchlevel 352) > [x86_64-linux] > >You''ve got some sort of ruby version mixup here - you''ve got ruby 1.8.7 that is trying to load a native extension compiled for ruby 1.9. I''d guess that is because your shebang is saying use /usr/bin/ruby, which is presumably the system provided ruby, but dvm has setup the environment variables that ruby uses to have it look for gems in the rvm copy of ruby. I assume that you can''t change the way it is invoked (to ruby process.rb rather than ./process.rb) but if you change the shebang to #!/usr/bin/env ruby that should pick up the rvm provided ruby, assuming that this script is running in a context where rvm has been loaded. Fred> Any help will be highly appreciated. > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/HWZH1LAlXu0J. For more options, visit https://groups.google.com/groups/opt_out.
delta force
2013-Feb-21 10:49 UTC
Re: [BUG] Segmentation fault ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Many Thanks Fred, It worked :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.