我是Ruby和Gems的新手,所以我可能会遗漏一些显而易见的东西:
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
我收到了几个Gems的错误,其中包括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 :(得分:2)
我终于安装了gsl!
重要的是安装与您正在使用的rb-gsl版本匹配的gsl版本,在我的情况下为1.14。
对于那些对我这样的c编译垃圾一无所知的人:
下载并解压缩您的gsl包 导航到终端中的该文件夹 输入以下命令:
./configure
make clean
make
sudo make install
make install命令我猜它会把它安装到标准位置吗?
一旦我这样做了,
sudo gem install gsl
工作得很好!
我还发现了这篇很棒的介绍文章,关于安装带有原生扩展的gem,以及所有这些东西实际上是做什么的:
http://patshaughnessy.net/2011/10/31/dont-be-terrified-of-building-native-extensions