2011-10-18 96 views
6

OSX獅子時,Xcode 4.2,GCC 4.2安裝bson_ext寶石OSX獅子

我收到以下錯誤安裝bson_ext 1.4.1

Building native extensions. This could take a while... 
ERROR: Error installing bson_ext: 
ERROR: Failed to build gem native extension. 

/Users/user/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for asprintf()... *** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 
+0

你有沒有安裝開發工具? – wrdevos

+0

同樣的問題在這裏。 1.4.0工作沒有任何問題。 – Matt

+0

是的,我最近安裝了Xcode 4.2。是否有單獨的開發人員工具軟件包? – chourobin

回答

2

我剛碰到這個。您應該查看mkmf.log文件。很有可能,它在錯誤的地方尋找GCC。我不得不:

cd /usr/bin 
sudo ln -s i686-apple-darwin11-llvm-gcc-4.2 i686-apple-darwin11-gcc-4.2.1 

而且一切都很好。

sudo /Developer/Library/uninstall-devtools –mode=all 

然後安裝此:

+0

哪裏可以找到mkmf.log?無論如何,這對我有用:'通過http://stackoverflow.com/questions/9353444/how-to-use-install-gcc- on-mac-os-x-10-8-xcode-4-4 –

+1

在輸出中,您會看到「記錄到$ {GEM_HOME} /gems/bson_ext-1.8.0/ext/cbson/gem_make.out」的結果 - mkmf.log位於與gem_make.out相同的目錄中。 –

+0

該解決方案對我無效。 OS X 10.8.2,Xcode 4.6(帶有命令行工具),bson_ext 1.8.2。仍然有相同的錯誤。 –

0

所以重新安裝OSX獅子解決了這一問題的任何人有問題。我想首先卸載xcode 4.1搞亂了我的開發工具安裝。

感謝您的幫助。

1

接受的答案不適用於我。但是這樣做。

我使用:

  • OS X 10.8.2
  • 的Xcode 4.6(用命令行工具)
  • bson_ext 1.8.2

cd /usr/bin && sudo ln -s ./gcc gcc-4.2

$ gem install bson_ext -v 1.8.2 
Building native extensions. This could take a while... 
Successfully installed bson_ext-1.8.2 
1 gem installed 
Installing ri documentation for bson_ext-1.8.2... 
Installing RDoc documentation for bson_ext-1.8.2...