我試圖在第二臺計算機上安裝我的rails應用程序。但是,當我運行bundle install
我得到一個錯誤使用JSON寶石:無法在Mac OS X上安裝json 1.8 gem 10.8.4
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D (-h will show valid options) (RuntimeError)
Gem files will remain installed in /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0 for inspection.
Results logged to /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.
計算機運行的Mac OS X 10.8.4和Xcode 4.6.3和最新的命令行工具。
$ rvm -v
rvm 1.21.2 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
$ gem -v
2.0.3
當我嘗試使用gem install json
安裝JSON寶石,我得到幾乎相同的錯誤:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D (-h will show valid options) (RuntimeError)
Gem files will remain installed in /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0 for inspection.
Results logged to /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
嘗試使用sudo
沒有安裝
我用RVM安裝了最新的紅寶石改變一切。
我卸載並重新安裝了自制軟件,rvm,ruby &命令行工具,但沒有什麼幫助。
更新
Contentent的/Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
:
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D (-h will show valid options) (RuntimeError)
GCC版本:
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
更新2
我做全新安裝的OS X,Xcode,命令行工具,Homebrew,rvm和Ruby。 Ruby現在是修補程序級別247,該死的問題仍然存在。什麼是浪費時間......如果是重要的:RVM安裝JSON 1.7.7加上紅寶石
更新3
看來,我的機器上的所有原生擴展失敗。 gem install bcrypt-ruby
給出相同的錯誤信息。
您可以要求/Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out的內容 – Remear
因爲它包含只有2行,我把它插入到原文中。 – stevecross
這一次讓我目前有些失落。我和你的設置完全一樣,並且json gem安裝沒有問題。 rvm 1.21.2,gem 2.0.3,ruby 2.0.0p195(2013-05-14修訂版40734)[x86_64-darwin12.3.0]。你機器上的gcc -v的輸出是什麼? – Remear