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构建系统的问题

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...