2011-11-17 52 views
0

我是新來的Ruby和寶石,所以我可能失去了一些東西這是顯而易見的:我通常當我嘗試安裝寶石得到這個錯誤

ERROR: Error installing matlab-ruby: 
    ERROR: Failed to build gem native extension. 

     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 

我已經得到了錯誤的幾個寶石,中他們Ruby Ruby GSL。

我正在運行Mac OS 10.7.2,Ruby 1.8.7和XCode 4.2,如果這很重要。

完全控制檯輸出:

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

     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
extconf.rb:1: command not found: gsl-config --version 
*** 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. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
extconf.rb:237: Check GSL>=0.9.4 is installed, and the command "gsl-config" is in search path. (RuntimeError) 
checking gsl version... 

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/gsl-1.14.7 for inspection. 
Results logged to /Library/Ruby/Gems/1.8/gems/gsl-1.14.7/ext/gem_make.out 
+0

請張貼整個錯誤消息。它通常包含有關故障原因的信息。 –

+0

我在查找OS X的解決方案時遇到了這篇文章 - 如果有人遇到同樣的問題,[本文](http://hi.baidu.com/rainchen/item/e9f24fc009c227340831c6a2)中的說明幫助我解決這個問題。 – gotofritz

回答

2

我終於裝GSL!

重要的是安裝與您使用的rb-gsl版本匹配的gsl版本,在我的情況下是1.14。

對於那些誰一無所知在C編譯廢話我一樣:

下載和解壓您的GSL包 導航到該文件夾​​中的終端 鍵入以下命令:

./configure 
make clean 
make 
sudo make install 

make install的命令我想把它安裝到標準位置?

一旦我做到了,

sudo gem install gsl 

工作就好了!

我也發現有關與原生擴展安裝寶石和什麼赫克這一切的東西其實就是做這個偉大的介紹文章:

http://patshaughnessy.net/2011/10/31/dont-be-terrified-of-building-native-extensions

相關問題