'无法构建gem原生扩展'运行bundle install时

时间:2016-10-27 21:36:59

标签: ruby-on-rails ruby rubygems windows-10 bundler

当我运行"捆绑安装"在我的项目目录中,我收到以下错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    c:/Ruby22/bin/ruby.exe -r ./siteconf20161028-11856-1tljde.rb extconf.rb
checking for CLOCK_MONOTONIC in time.h... yes
checking for clockid_t in time.h... yes
checking for clock_gettime() in -lrt... no
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for poll() in poll.h... no
checking for getaddrinfo() in sys/types.h,sys/socket.h,netdb.h... no
getaddrinfo required
*** 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=c:/Ruby22/bin/$(RUBY_BASE_NAME)
        --with-rtlib
        --without-rtlib
        --with-nsllib
        --without-nsllib
        --with-socketlib
        --without-socketlib

extconf failed, exit code 1

Gem files will remain installed in c:/Ruby22/lib/ruby/gems/2.2.0/gems/kgio-2.9.2
for inspection.
Results logged to
c:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/kgio-2.9.2/gem_make.out

An error occurred while installing kgio (2.9.2), and Bundler cannot continue.
Make sure that `gem install kgio -v '2.9.2'` succeeds before bundling.

这是我的Gemfile:

source 'https://rubygems.org'

#don't upgrade
gem 'rails', '3.2.11'
gem 'rack', '1.4.0'

ruby '2.2.5'


gem 'rack-attack'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'foreman'

group :development do
  gem 'brakeman'
  gem 'bundler-audit'
  gem 'guard-brakeman'
  gem 'guard-livereload'
  gem 'guard-rspec'
  gem 'guard-shell'
  gem 'pry'
  gem 'rack-livereload'
  gem 'rb-fsevent'
  gem 'travis-lint'
  gem 'better_errors'
  gem 'binding_of_caller'
end

gem 'gauntlt'

gem 'simplecov', :require => false, :group => :test

group :development, :test do
  gem 'launchy'
  gem 'capybara'
  gem 'database_cleaner'
  gem 'poltergeist'
  gem 'rspec-rails', '2.14.2'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'jquery-fileupload-rails'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
 gem 'bcrypt'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
 gem 'unicorn'

# Pow related gem
gem 'powder'

gem 'aruba'
#gem 'minitest', '~> 4.0', :require=> "minitest/autorun"

#gem 'minitest'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

gem 'execjs'
gem 'therubyracer'

# Add SMTP server support using MailCatcher
gem 'mailcatcher'

我使用ruby 2.2.5在Windows 10上运行 我不确定导轨版本是什么原因是我在尝试时遇到错误。 rails -v'。我不会认为这是我面对上述错误的原因,因为他们会把这些错误归咎于' rails -v'错误是最近的事情。

1 个答案:

答案 0 :(得分:1)

你的Gemfile中有gem 'unicorn'吗?

Unicorn要求kgio无法安装,我不确定这个gem是否适用于Window。尝试将服务器从unicorn更改为thin - 它可以用于开发。

您也可以在Gemfile中指定gems平台

platforms :ruby do #unux
  gem 'unicorn'
end

platforms :mswin do
  #gems specific to windows
end

希望有所帮助