当我尝试安装 gems 时,我通常会收到此错误

发布于 2024-12-16 02:45:04 字数 1519 浏览 6 评论 0 原文

我是 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

I'm new to Ruby and Gems, so I might be missing something that's obvious:

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

I've gotten the error for several Gems, among them Ruby GSL.

I'm running Mac OS 10.7.2, Ruby 1.8.7, and XCode 4.2, if that matters.

Full console output:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久光 2024-12-23 02:45:04

我终于安装了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

I finally got gsl installed!

The important thing is to install the version of gsl that matches the version of rb-gsl you are using, in my case 1.14.

For those who know nothing about compiling crap in c like me:

Download and unzip your gsl package
Navigate to that folder in the terminal
Type these commands:

./configure
make clean
make
sudo make install

The make install command I guess installs it to the standard location?

Once I did that,

sudo gem install gsl

worked just fine!

I also found this great intro article about installing gems with native extensions and what the heck all this stuff is actually doing:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文