【问题标题】:Upgrade to Lion, failed to build gem native extensions升级到 Lion,构建 gem 原生扩展失败
【发布时间】:2011-07-28 01:12:52
【问题描述】:

不确定我的问题是否与此线程有关 (http://stackoverflow.com/questions/6589066/rmagick-and-os-x-lion),但我刚刚升级到 Lion;更具体地说,我购买了一台新机器并迁移了我的旧配置文件。

我无法启动 rails 3,因为它找不到 rmagick,我无法安装 rmagick,因为我收到以下错误。我尝试卸载 rmagick 和 imageMagick,但在尝试捆绑安装时仍然遇到相同的错误。有什么想法吗? 谢谢

Installing rmagick (2.13.1) with native extensions /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions': ERROR:     Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

    /opt/local/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** 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=/opt/local/bin/ruby


Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:504:in `each'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:504:in `build_extensions'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:180:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `send'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/bin/bundle:13
from /opt/local/bin/bundle:19:in `load'
from /opt/local/bin/bundle:19

更新 所以我更新到 Xcode4,当我 brew --config 它仍然表明我缺少 GCC 的东西:

HOMEBREW_VERSION: 0.8
HEAD: 8368fe489bde47b8f201bfcfdf328944fdf7092b
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: quad-core 64-bit sandybridge
OS X: 10.7
Kernel Architecture: x86_64
Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 
GCC-4.0: N/A 
GCC-4.2: N/A 

怎么会这样??

【问题讨论】:

    标签: macos rubygems osx-lion rmagick


    【解决方案1】:

    看来您需要安装 Xcode 的 Unix 开发工具。

    您可以在从 Mac App Store 安装 Xcode 时安装 Unix 工具:http://itunes.apple.com/us/app/xcode/id448457090?mt=12

    【讨论】:

    • 我希望你是对的。我实际上有 Xcode 3,但我目前正在安装 Xcode 4。实际上,自从我的原始帖子以来,我遇到了更多问题。如果我brew doctor 并在我brew update fatal: Unable to create '/usr/local/.git/index.lock': Permission denied Error: Failure while executing: git checkout -q master 时出现以下错误,则会出现很多问题。让我们看看 Xcode 4 做了什么……
    • 是的,Xcode 3 不能在 Lion 上运行。安装 Xcode 4,然后您可能需要重新安装 Homebrew。
    • @Jeff Peterson 实际上 Xcode 3 确实可以在 Lion 上运行,只是安装程序不允许您安装它。您可以修改安装程序包,它会安装(并运行)就好了:anatomicwax.tumblr.com/post/7906770311/…
    【解决方案2】:

    我已经尝试了这里提到的所有方法,但没有任何帮助。 这节省了我的一天: https://gist.github.com/3182604

    注意: 1. 从首选项/下载更新 XCode 2.安装X11.app 3. 然后才修复 ImageMagick gem

    【讨论】:

      【解决方案3】:

      来自 https://github.com/mxcl/homebrew/wiki/Installation 的 Homebrew 安装说明

      "1 通过 App Store 安装仅适用于 Lion 用户。对于其他版本的 Mac OS X,请参见此处。如果您通过 App Store 安装,则需要运行“安装 Xcode”应用程序放在 /Applications 中。"

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-03-22
        • 1970-01-01
        • 1970-01-01
        • 2020-07-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多