【问题标题】:Installing thin (1.5.0) with native extensions "...ERROR: Failed to build gem native extension."安装带有本机扩展的瘦(1.5.0)“...错误:无法构建 gem 本机扩展。”
【发布时间】:2012-11-03 12:02:32
【问题描述】:

我有一个新项目需要使用 Thin,但出现了问题。 在我的 Gemfile 中。

gem 'thin'

然后我运行“捆绑安装”。它显示:

......
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/Cellar/ruby/1.9.3-p194/bin/ruby extconf.rb 
checking for main() in -lc... *** 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=/usr/local/Cellar/ruby/1.9.3-p194/bin/ruby
    --with-thin_parser-dir
    --without-thin_parser-dir
    --with-thin_parser-include
    --without-thin_parser-include=${thin_parser-dir}/include
    --with-thin_parser-lib
    --without-thin_parser-lib=${thin_parser-dir}/lib
    --with-clib
    --without-clib
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:845:in `block in have_library'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:840:in `have_library'
    from extconf.rb:4:in `<main>'


Gem files will remain installed in /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thin-1.5.0 for inspection.
Results logged to /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thin-1.5.0/ext/thin_parser/gem_make.out
An error occured while installing thin (1.5.0), and Bundler cannot continue.
Make sure that `gem install thin -v '1.5.0'` succeeds before bundling.

请帮我解决这个问题。之前安装过thin,不知道为什么这次失败了。

【问题讨论】:

  • 查看此链接以获取您的解决方案stackoverflow.com/questions/3649252/…
  • 我以前试过这种方式。它没有用。
  • 我发现了我的问题。我更新了 Xcode,我必须重新安装命令行工具。

标签: ruby-on-rails-3 thin


【解决方案1】:

gem 安装瘦 或者 gem install thin -v '1.5.0'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-26
    • 1970-01-01
    • 2014-03-23
    • 2019-06-20
    • 2016-11-23
    • 2017-11-02
    • 1970-01-01
    • 2014-08-27
    相关资源
    最近更新 更多