5

我将独角兽添加到我的 Gemfile 中,之后当我进行捆绑安装时出现此错误

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

        /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb 
checking for CLOCK_MONOTONIC in time.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
    --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=/Users/adim86/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
/Users/adim86/.rvm/rubies/ruby-1.9.3-p0/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 /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:686:in `macro_defined?'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:822:in `block in have_macro'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:821:in `have_macro'
    from extconf.rb:5:in `<main>'


Gem files will remain installed in /Users/adim86/.rvm/gems/ruby-1.9.3-p0/gems/kgio-2.7.4 for inspection.
Results logged to /Users/adim86/.rvm/gems/ruby-1.9.3-p0/gems/kgio-2.7.4/ext/kgio/gem_make.out
An error occured while installing kgio (2.7.4), and Bundler cannot continue.
Make sure that `gem install kgio -v '2.7.4'` succeeds before bundling

我的 gem 文件看起来像这样。我尝试将独角兽添加到生产块中,但我仍然遇到相同的错误。我也删除了独角兽,我仍然得到同样的错误也尝试了捆绑更新无济于事:

source 'https://rubygems.org'

gem 'rails', '3.2.3'

gem 'devise'
gem 'haml-rails'

gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'twitter'
gem 'fb_graph'

gem 'json'
gem 'json_pure'

gem 'simple_form'
gem 'postmark'
gem 'postmark-rails'

gem 'bootstrap-datepicker-rails'
gem 'watu_table_builder', :require => 'table_builder'

gem 'sqlite3'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'uglifier', '>= 1.0.3'
end

gem "therubyracer", :require => 'v8'

gem 'jquery-rails'

gem 'differ'


gem 'whenever'
gem 'unicorn'

谁能帮忙?

4

5 回答 5

3

Unicorn,旨在利用类 Unix 系统中的功能。

换句话说,它们不能在 Windows 上运行

于 2013-08-26T00:43:16.277 回答
2

我最近遇到了这个问题。就我而言,这是因为由于某种未知原因,CC 的环境变量(它是 Apple 的 LLVM 编译器的垫片)没有被设置。打字:

$ export CC=cc

bundle install在为我工作之前在终端中。

要使更改永久生效,您可以添加export CC=cc到 .bash_profile 文件中。

如果您执行后者,请确保您键入:

$ source ~/.bash_profile 

(或打开一个新的终端窗口),然后再执行bundle install.

于 2013-11-02T12:01:00.690 回答
2

问题是 Xcode。转到 Xcode 设置 -> 下载并确保您已安装“命令行工具”。一旦我安装它们,bundle install运行就好了。

于 2012-09-14T04:21:45.993 回答
0

这可能需要更新的 ruby​​ 补丁级别 - 比如p194- 安装它:

rvm install 1.9.3-p194

然后再试一次。

您应该始终使用可用的最新补丁级别,RVM 允许这样做:

rvm get stable
rvm use 1.9.3 --install
于 2012-09-12T06:39:09.003 回答
-2

我曾经rvm use system安装宝石。生活在红宝石边缘的代价是什么?

于 2012-09-14T04:41:44.987 回答