微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby – Gem :: Ext :: BuildError:错误:无法构建gem原生扩展–nio4r

我正在尝试在我的gemfile及其依赖项中安装所有gem,因此只需运行Bundler(bundle或bundle install).在使用本机扩展安装nio4r 1.1.1时失败,下面是登录gem_make.out.

/opscode/chef/embedded/bin/ruby.exe -r ./siteconf20150924-7480-ocwr34.rb extconf.rb
checking for unistd.h... *** 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=/opscode/chef/embedded/bin/ruby
/opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler Failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:1038:in `block in have_header'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:889:in `block in checking_for'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:888:in `checking_for'
    from /opscode/chef/embedded/lib/ruby/2.0.0/mkmf.rb:1037:in `have_header'
    from extconf.rb:3:in `'

extconf Failed,exit code 1

我可以看到捆绑器正在检查unistd.h并且在那时失败了.我确保此标头在PATH中可用,并且还为我的版本安装了ruby devkit.执行gem install nio4r也会出现同样的错误.

解决方法

尝试xcode-select – install first.This可能是xcode构建系统的问题

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐