2011-09-14 151 views
2

我剛剛安裝了帶有Xcode 4.1的OS X Lion。我使用Ruby 1.9.2和寶石版本1.5.0。當試圖從Rails 3.0.9升級到3.1時,出現以下錯誤:更新到Rails 3.1失敗

$ ruby -v 
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-darwin9.8.0] 
$ rails -v 
Rails 3.0.9 
$ gem -v 
1.5.0 
$ gem update rails 
Updating installed gems 
Updating rails 
Building native extensions. This could take a while... 
ERROR: Error installing rails: 
    ERROR: Failed to build gem native extension. 

     /Users/me/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb 
creating Makefile 

make 
gcc -I. -I/Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/i386-darwin9.8.0 -I/Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o bcrypt_ext.o -c bcrypt_ext.c 
In file included from /Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby.h:32, 
       from bcrypt_ext.c:1: 
/Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/ruby.h:108: error: size of array ‘ruby_check_sizeof_long’ is negative 
/Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/ruby.h:112: error: size of array ‘ruby_check_sizeof_voidp’ is negative 
In file included from /Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/intern.h:29, 
       from /Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/ruby.h:1327, 
       from /Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby.h:32, 
       from bcrypt_ext.c:1: 
/Users/me/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/st.h:69: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative 
bcrypt_ext.c: In function ‘bc_salt’: 
bcrypt_ext.c:42: warning: implicit conversion shortens 64-bit value into a 32-bit value 
make: *** [bcrypt_ext.o] Error 1 


Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.2-p0/gems/bcrypt-ruby-3.0.1 for inspection. 
Results logged to /Users/me/.rvm/gems/ruby-1.9.2-p0/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out 
Nothing to update 

有沒有人知道這裏發生了什麼?

謝謝!

回答

1

而不是做 「更新」 的,只是 「創業板安裝導軌-v 3.1」

UPDATE: 顯然軌3.1.0(activemodel的實際)取決於bcrypt-紅寶石。 3.1.1中應刪除此依賴關係(請參閱https://github.com/rails/rails/issues/2687)。

如果您不想等待,您需要解決bcrypt-ruby的構建問題。編譯器錯誤提示ruby與編譯器之間存在32位/ 64位不匹配。您是否將Lion安裝在Leopard上?如果是這樣,你可能不得不重建所有的rvm紅寶石和本地擴展寶石。

即使您想等待,您可能應該重新編譯,因爲您可能會再次遇到此類編譯器問題。作爲測試,請嘗試安裝一個本地gem,如:「gem install eventmachine」。如果你得到相同的錯誤,這是一個很好的指標,每個本地寶石都會遇到這個問題。 http://jtigger-learning.wikidot.com/gem-install-fails-on-building-native-extensions

+0

OP說,他得到了同樣的錯誤:

的人誰在升級到雪豹,這個問題的解釋類似的問題,請參見本頁面。 –

+0

@robert我沒有看到OP提到的「gem install」。我只看到「寶石更新」。 – Kelvin

+0

他發佈了我刪除的非答覆。它所說的只是「試過了,並且得到了這個錯誤......」並且他複製了與上面在問題中看到的基本相同的文本。我會取消刪除答案,以便您可以看到它。 –