Ruby nubie on OSX - can't get beyond rake db:migrate - get [BUG] Bus Error

☆樱花仙子☆ 提交于 2019-12-14 04:27:50

问题


Original problem:

I'm (a newbie to ruby) using RVM to manage my ruby on Mac OSX 10.6

Here's my mac OX info:

$ rvm info

ruby-1.9.2-head@1.9.2-head-gemset:

  system:
    uname:       "Darwin fillibuster-2.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (i386-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.5.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p188"
    date:         "2011-03-28"
    platform:     "i386-darwin10.6.0"
    patchlevel:   "2011-03-28 revision 31204"
    full_version: "ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin10.6.0]"

  homes:
    gem:          "/Users/dawnbuie/.rvm/gems/ruby-1.9.2-head@1.9.2-head-gemset"
    ruby:         "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head"

  binaries:
    ruby:         "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head/bin/ruby"
    irb:          "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head/bin/irb"
    gem:          "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head/bin/gem"
    rake:         "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head/bin/rake"

  environment:
    PATH:         "/Users/dawnbuie/.rvm/gems/ruby-1.9.2-head@1.9.2-head-gemset/bin:/Users/dawnbuie/.rvm/gems/ruby-1.9.2-head@global/bin:/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head/bin:/Users/dawnbuie/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
    GEM_HOME:     "/Users/dawnbuie/.rvm/gems/ruby-1.9.2-head@1.9.2-head-gemset"
    GEM_PATH:     "/Users/dawnbuie/.rvm/gems/ruby-1.9.2-head@1.9.2-head-gemset:/Users/dawnbuie/.rvm/gems/ruby-1.9.2-head@global"
    MY_RUBY_HOME: "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head"
    IRBRC:        "/Users/dawnbuie/.rvm/rubies/ruby-1.9.2-head/.irbrc"
    RUBYOPT:      ""
    gemset:       "1.9.2-head-gemset"

Here are my installed gem versions

$ gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.6)
actionpack (3.0.6)
activemodel (3.0.6)
activerecord (3.0.6)
activeresource (3.0.6)
activesupport (3.0.6)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.11)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.15)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.6)
railties (3.0.6)
rake (0.8.7)
sqlite3-ruby (1.3.2)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.26)

I'm following a tutorial trying to get to the actual rails building part, and I'm fine up to here:

$ rails generate scaffold User name:string email:string

but am constantly getting the following error when I type this:

$ rake db:migrate

I don't know if the problem is the version of sqlite3, or ruby 1.9.2p180 - I've tried looking for this error using google and this is all I come up with https://redmine.ruby-lang.org/attachments/1505/ruby-1.9.2-bug.txt

I don't know how to interpret the errors below as I'm just figuring out how all the pieces fit together.

thank you for any pointers or help identifying the source of the error

The error message:

$ rake db:migrate --trace
(in /Users/bobstuff/Documents/Projects/rubyonrails/rails_projects/first_app)
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/lib/sqlite3/sqlite3_native.bundle: [BUG] Bus Error
ruby 1.9.2p180 (2011-02-18 revision 30909) [i386-darwin10.6.0]

-- control frame ----------
c:0029 p:-7277696 s:0087 b:0087 l:000086 d:000086 TOP   
c:0028 p:---- s:0085 b:0085 l:000084 d:000084 CFUNC  :require
c:0027 p:0029 s:0081 b:0081 l:000077 d:000080 BLOCK  /Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/lib/sqlite3.rb:6
c:0026 p:0035 s:0078 b:0078 l:000077 d:000077 TOP    /Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/lib/sqlite3.rb:2
c:0025 p:---- s:0076 b:0076 l:000075 d:000075 FINISH
c:0024 p:---- s:0074 b:0074 l:000073 d:000073 CFUNC  :require
c:0023 p:0026 s:0070 b:0070 l:000051 d:000069 BLOCK  /Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:68
c:0022 p:---- s:0067 b:0067 l:000066 d:000066 FINISH
c:0021 p:---- s:0065 b:0065 l:000064 d:000064 CFUNC  :each
c:0020 p:0091 s:0062 b:0062 l:000051 d:000061 BLOCK  /Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:66
c:0019 p:---- s:0057 b:0057 l:000056 d:000056 FINISH
c:0018 p:---- s:0055 b:0055 l:000054 d:000054 CFUNC  :each
c:0017 p:0046 s:0052 b:0052 l:000051 d:000051 METHOD /Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:55
c:0016 p:0021 s:0048 b:0048 l:000047 d:000047 METHOD /Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler.rb:120
c:0015 p:0079 s:0044 b:0044 l:000043 d:000043 TOP    /Users/bobstuff/Documents/Projects/rubyonrails/rails_projects/first_app/config/application.rb:7
c:0014 p:---- s:0042 b:0042 l:000041 d:000041 FINISH
c:0013 p:---- s:0040 b:0040 l:000039 d:000039 CFUNC  :require
c:0012 p:0013 s:0036 b:0036 l:000035 d:000035 METHOD <internal:lib/rubygems/custom_require>:29
c:0011 p:0026 s:0031 b:0031 l:000030 d:000030 TOP    /Users/bobstuff/Documents/Projects/rubyonrails/rails_projects/first_app/Rakefile:4
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 FINISH
c:0009 p:---- s:0027 b:0027 l:000026 d:000026 CFUNC  :load
c:0008 p:0334 s:0023 b:0023 l:000022 d:000022 METHOD /Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373
c:0007 p:0009 s:0018 b:0018 l:000011 d:000017 BLOCK  /Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2007
c:0006 p:0009 s:0016 b:0016 l:000015 d:000015 METHOD /Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2058
c:0005 p:0011 s:0012 b:0012 l:000011 d:000011 METHOD /Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2006
c:0004 p:0021 s:0009 b:0009 l:000008 d:000008 METHOD /Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:1991
c:0003 p:0139 s:0006 b:0006 l:000b74 d:000ed4 EVAL   /Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/bin/rake:35
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000b74 d:000b74 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/bin/rake:35:in `<main>'
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:1991:in `run'
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/Users/bobstuff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `load'
/Users/bobstuff/Documents/Projects/rubyonrails/rails_projects/first_app/Rakefile:4:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/Users/bobstuff/Documents/Projects/rubyonrails/rails_projects/first_app/config/application.rb:7:in `<top (required)>'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler.rb:120:in `require'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:55:in `require'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:55:in `each'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:66:in `block in require'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:66:in `each'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/lib/bundler/runtime.rb:68:in `require'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/lib/sqlite3.rb:2:in `<top (required)>'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/lib/sqlite3.rb:6:in `rescue in <top (required)>'
/Users/bobstuff/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/lib/sqlite3.rb:6:in `require'

-- C level backtrace information -------------------------------------------
0   libruby.1.9.1.dylib                 0x00195ca6 rb_vm_bugreport + 230
1   libruby.1.9.1.dylib                 0x0003f03f report_bug + 415
2   libruby.1.9.1.dylib                 0x0003f0eb rb_bug + 43
3   libruby.1.9.1.dylib                 0x0010df4b sigbus + 27
4   libSystem.B.dylib                   0x97b8246b _sigtramp + 43
5   ???                                 0xffffffff 0x0 + 4294967295
6   libruby.1.dylib                     0x00754f27 rb_intern + 62
7   libruby.1.dylib                     0x0070b7b2 rb_define_module + 32
8   sqlite3_native.bundle               0x004f160f Init_sqlite3_native + 27
9   libruby.1.9.1.dylib                 0x00004bd4 dln_load + 244
10  libruby.1.9.1.dylib                 0x001791cb rb_vm_call_cfunc + 187
11  libruby.1.9.1.dylib                 0x000462fe rb_require_safe + 1022
12  libruby.1.9.1.dylib                 0x00191010 vm_call_method + 944
13  libruby.1.9.1.dylib                 0x0017a845 vm_exec_core + 5397
14  libruby.1.9.1.dylib                 0x00184aed vm_exec + 1821
15  libruby.1.9.1.dylib                 0x00184fd6 rb_iseq_eval + 358
16  libruby.1.9.1.dylib                 0x00044f35 rb_load_internal + 293
17  libruby.1.9.1.dylib                 0x00046332 rb_require_safe + 1074
18  libruby.1.9.1.dylib                 0x00191010 vm_call_method + 944
19  libruby.1.9.1.dylib                 0x0017a845 vm_exec_core + 5397
20  libruby.1.9.1.dylib                 0x00184aed vm_exec + 1821
21  libruby.1.9.1.dylib                 0x0019231c rb_yield + 604
22  libruby.1.9.1.dylib                 0x0000ac6e rb_ary_each + 62
23  libruby.1.9.1.dylib                 0x00191010 vm_call_method + 944
24  libruby.1.9.1.dylib                 0x0017a845 vm_exec_core + 5397
25  libruby.1.9.1.dylib                 0x00184aed vm_exec + 1821
26  libruby.1.9.1.dylib                 0x0019231c rb_yield + 604
27  libruby.1.9.1.dylib                 0x0000ac6e rb_ary_each + 62
28  libruby.1.9.1.dylib                 0x00191010 vm_call_method + 944
29  libruby.1.9.1.dylib                 0x0017a845 vm_exec_core + 5397
30  libruby.1.9.1.dylib                 0x00184aed vm_exec + 1821
31  libruby.1.9.1.dylib                 0x00184fd6 rb_iseq_eval + 358
32  libruby.1.9.1.dylib                 0x00044f35 rb_load_internal + 293
33  libruby.1.9.1.dylib                 0x00046332 rb_require_safe + 1074
34  libruby.1.9.1.dylib                 0x00191010 vm_call_method + 944
35  libruby.1.9.1.dylib                 0x0017a845 vm_exec_core + 5397
36  libruby.1.9.1.dylib                 0x00184aed vm_exec + 1821
37  libruby.1.9.1.dylib                 0x00184fd6 rb_iseq_eval + 358
38  libruby.1.9.1.dylib                 0x00044f35 rb_load_internal + 293
39  libruby.1.9.1.dylib                 0x00046918 rb_f_load + 136
40  libruby.1.9.1.dylib                 0x00175835 call_cfunc + 581
41  libruby.1.9.1.dylib                 0x00191010 vm_call_method + 944
42  libruby.1.9.1.dylib                 0x0017a845 vm_exec_core + 5397
43  libruby.1.9.1.dylib                 0x00184aed vm_exec + 1821
44  libruby.1.9.1.dylib                 0x00184e47 rb_iseq_eval_main + 535
45  libruby.1.9.1.dylib                 0x00042569 ruby_exec_internal + 153
46  libruby.1.9.1.dylib                 0x00044aca ruby_run_node + 90
47  ruby                                0x00001f1f main + 95
48  ruby                                0x00001eb5 start + 53

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap

EDIT: Answer found:

The problem was I was using an old (2007!) mac architecture - MacBook Core Duo (not to be confused with Core 2 Duo) which is 32 bit, NOT current 64 bit, and the current version of sqlite3 recommended in this tutorial (gem 'sqlite3-ruby', :require => 'sqlite3') did not work with the rest of my Gems. I uninstalled sqlite,

gem uninstall sqlite3 sqlite3-ruby
gem pristine --all  // not sure if necessary, suggested in comments

edited my Gemfile to:

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

then

Bundle install
rake db:migrate

and it works! So far.

I found the suggestion by Josh Crews to use an earlier version of sqlite3 - even though he was using it on Leopard, with ruby 1.8.7.


回答1:


See answer at top of question.


The problem was I was using an old (2007!) mac architecture - MacBook Core Duo (not to be confused with Core 2 Duo) which is 32 bit, NOT current 64 bit, and the current version of sqlite3 recommended in this tutorial (gem 'sqlite3-ruby', :require => 'sqlite3') did not work with the rest of my Gems. I uninstalled sqlite,

gem uninstall sqlite3 sqlite3-ruby
gem pristine --all  // not sure if necessary, suggested in comments

edited my Gemfile to:

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

then

Bundle install
rake db:migrate

and it works! So far.

I found the suggestion by Josh Crews to use an earlier version of sqlite3 - even though he was using it on Leopard, with ruby 1.8.7.




回答2:


OK, let's see if we can get your config straightened out.

You're using RVM, and a current rev of Ruby, so gather even more info about your RVM environment. Type rvm info and add that output to your original question by editing it. That will tell us more about what RVM knows.

Here's some questions:

  1. Did you previously have Leopard installed, with RVM, then switch to Snow Leopard? If so, your Ruby would be compiled for 32-bit, but any native drivers compiled since then would be 64-bit which can cause real weird behavior. Fixing that takes a couple commands and some recompiling but it isn't overly painful.
  2. Did you install Apple's XCode from the Snow Leopard DVD, or as a fresh install directly from Apple's XCode site? The version of XCode on the Snow Leopard was buggy and shouldn't be used. You can download a free copy from Apple's site. It's a big download.
  3. Is your RVM current? Periodically run rvm get update. That might not help this particular problem, but it can fix some oddities. Use rvm -v to check the version. v1.5.2 is current as of today.

Some of the info at sqlite3-ruby can't make on rvm 1.8.7 might help.


EDIT:

A couple things stand out from your rvm info:

  • Your version of Ruby 1.9.2 is p188. p180 is the current stable version if I remember right, at least it is according to what RVM knows: rvm list known shows its list. That might cause problems with drivers that haven't been tested together. You might want to consider installing the current "1.9.2". RVM has a nice upgrade command that will let you install and copy your gems between versions of Ruby, so try rvm upgrade 1.9.2-p188 1.9.2-p180, then try running your app and see if SQLite is still being uncooperative.
  • Your version of Ruby 1.9.2-p188 is compiled as 32-bit. Your rvm info shows "i386-apple-darwin10.0" in several places. A 64-bit Ruby would show: "x86_64-darwin10.6.0". You can easily recompile a Ruby version by telling RVM to uninstall it, then install it again, i.e. rvm uninstall 1.9.2p188 && rvm install 1.9.2p188 should do it. Then you'll need to rebuild your gems that have native drivers: gem pristine --all will rebuild all installed gems.


来源:https://stackoverflow.com/questions/5575612/ruby-nubie-on-osx-cant-get-beyond-rake-dbmigrate-get-bug-bus-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!