0

我是 RoR 的初学者并尝试设置 Netbeans IDE。有人可以帮我解决 Netbeans 中 rmagick 的捆绑器错误吗?

我有以下ROR开发环境:

Qadeers-MacBook:gems Qadeer$ rvm info
ruby-1.9.3-p194:
  system:
    uname:       "Darwin Qadeers-MacBook.xxxxxx.com 11.4.0 Darwin Kernel Version 11.4.0"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
    zsh:         "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
  rvm:
    version:      "rvm 1.15.5 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "21 hours 49 minutes 4 seconds ago"
  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "x86_64-darwin11.4.0"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]"
  homes:
    gem:          "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194"
    ruby:         "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194"
  binaries:
    ruby:         "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"
  environment:
    PATH:         "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194/bin:/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/Qadeer/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/Cellar/ruby/1.9.3-p194/bin:/usr/X11/bin:/usr/local/git/bin"
    GEM_HOME:     "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194"
    GEM_PATH:     "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194:/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

我正在使用 Netbeans IDE 6.9.1 并且有一个 gem 依赖项

gem "rmagick", ">= 1.15.17"

当我使用捆绑器在我的 gemfile 中安装依赖项时,它失败并出现错误

Installing rmagick (2.13.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/bin/gcc-4.2... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /usr/bin:/bin:/usr/sbin:/sbin

*** 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
        --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=/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
Gem files will remain installed in /Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.

所以,我直接使用命令成功安装了gem

Qadeers-MacBook:gems Qadeer$ gem install rmagick -v '2.13.1'
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...

请注意,尽管上述操作成功,但我仍然看不到在 netbeans ruby​​ 平台屏幕中已安装的 gem 列表中列出的 gem。不知道为什么..

我已经知道 ImageMagick 已安装在我的机器上

Qadeers-MacBook:gems Qadeer$ ruby -rRMagick -e "puts Magick::Long_version"
This is RMagick 2.13.1 ($Date: 2009/12/20 02:33:33 $) Copyright (C) 2009 by Timothy P. Hunter
Built with ImageMagick 6.7.7-6 2012-08-23 Q16 http://www.imagemagick.org
Built for ruby 1.9.3
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org

对 Magick-config 文件进行定位会导致以下路径,因为它是使用 brew 安装的。

Qadeers-MacBook:gems Qadeer$ locate Magick-config
/usr/local/Cellar/imagemagick/6.7.7-6/bin/Magick-config
/usr/local/Cellar/imagemagick/6.7.7-6/share/man/man1/Magick-config.1
/usr/local/bin/Magick-config
/usr/local/share/man/man1/Magick-config.1

问题是,我如何告诉 netbeans 使用上述路径中的 Magick-config 而不是只查看 /usr/bin:/bin:/usr/sbin:/sbin ?

任何帮助深表感谢..!

4

1 回答 1

0

这就是答案.. !!! 在我发布它几分钟后,我发现这个链接是中文的。虽然我不会说中文,但我只能按照屏幕更新配置文件并重新启动 netbeans。瞧,改变奏效了。解决方案只是 Netbeans 需要 /usr/local/bin 的扩展路径变量,其中存在 Magick-config 文件。完成此操作后,IDE 就可以安装 rmagick。谢谢,希望这对以后的人有用..

于 2012-09-01T08:41:57.170 回答