简体   繁体   English

使用厨师食谱安装Nokigori时出错

[英]Error when installing Nokigori with Chef recipe

I'm trying to install and use Nokigoro for XML parsing (if there is an alternative parser that doesn't result in mindless head hitting of wall - I'm happy to check it out) 我正在尝试安装Nokigoro并将其用于XML解析(如果有其他解析器不会导致无意识的撞墙-我很乐意进行检查)

I'm running this via a recipe on the chef client, in my recipe I have: 我正在通过厨师客户端上的配方运行此程序,在我的配方中有:

    # include_recipe 'ohai'
chef_gem 'nokogiri'
require 'nokogiri'

which is as far as it gets really. 尽其所能。

Running this as my run list results in the following error: 将其作为我的运行列表运行会导致以下错误:

    Starting Chef Client, version 12.12.15
[2017-03-31T14:07:36+00:00] WARN: Run List override has been provided.
[2017-03-31T14:07:36+00:00] WARN: Original Run List: []
[2017-03-31T14:07:36+00:00] WARN: Overridden Run List: [recipe[steve-solr]]
resolving cookbooks for run list: ["steve-solr"]
Synchronizing Cookbooks:
  - steve-solr (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Recipe: steve-solr::default
  * chef_gem[nokogiri] action install

    ================================================================================
    Error executing action `install` on resource 'chef_gem[nokogiri]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" ----
    STDOUT: Building native extensions.  This could take a while...
    STDERR: ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

        current directory: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.7.1/ext/nokogiri
    /opt/chef/embedded/bin/ruby -r ./siteconf20170331-19864-1d63c49.rb extconf.rb
    checking if the C compiler accepts ... *** 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=/opt/chef/embedded/bin/ruby
        --help
        --clean
    /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
    You have to install development tools first.
        from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:582:in `block in try_compile'
        from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:533:in `with_werror'
        from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:582:in `try_compile'
        from extconf.rb:138:in `nokogiri_try_compile'
        from extconf.rb:162:in `block in add_cflags'
        from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:630:in `with_cflags'
        from extconf.rb:161:in `add_cflags'
        from extconf.rb:406:in `<main>'

    To see why this extension failed to compile, please check the mkmf.log which can be found here:

      /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.7.1/mkmf.log

    extconf failed, exit code 1

    Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.7.1 for inspection.
    Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.7.1/gem_make.out
    ---- End output of /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" ----
    Ran /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" returned 1

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/steve-solr/recipes/default.rb:8:in `from_file'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/steve-solr/recipes/default.rb

      8: chef_gem 'nokogiri'
      9: require 'nokogiri'

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/steve-solr/recipes/default.rb:8:in `from_file'

    chef_gem("nokogiri") do
      package_name "nokogiri"
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :chef_gem
      cookbook_name "steve-solr"
      recipe_name "default"
      gem_binary "/opt/chef/embedded/bin/gem"
    end

    Platform:
    ---------
    x86_64-linux


  ================================================================================
  Recipe Compile Error in /var/chef/cache/cookbooks/steve-solr/recipes/default.rb
  ================================================================================

  Mixlib::ShellOut::ShellCommandFailed
  ------------------------------------
  chef_gem[nokogiri] (steve-solr::default line 8) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
  ---- Begin output of /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" ----
  STDOUT: Building native extensions.  This could take a while...
  STDERR: ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

      current directory: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.7.1/ext/nokogiri
  /opt/chef/embedded/bin/ruby -r ./siteconf20170331-19864-1d63c49.rb extconf.rb
  checking if the C compiler accepts ... *** 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=/opt/chef/embedded/bin/ruby
    --help
    --clean
  /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
  You have to install development tools first.
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:582:in `block in try_compile'
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:533:in `with_werror'
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:582:in `try_compile'
    from extconf.rb:138:in `nokogiri_try_compile'
    from extconf.rb:162:in `block in add_cflags'
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:630:in `with_cflags'
    from extconf.rb:161:in `add_cflags'
    from extconf.rb:406:in `<main>'

  To see why this extension failed to compile, please check the mkmf.log which can be found here:

    /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.7.1/mkmf.log

  extconf failed, exit code 1

  Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.7.1 for inspection.
  Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.7.1/gem_make.out
  ---- End output of /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" ----
  Ran /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" returned 1

  Cookbook Trace:
  ---------------
    /var/chef/cache/cookbooks/steve-solr/recipes/default.rb:8:in `from_file'

  Relevant File Content:
  ----------------------
  /var/chef/cache/cookbooks/steve-solr/recipes/default.rb:

    1:  #
    2:  # Cookbook Name:: steve-solr
    3:  # Recipe:: default
    4:  #
    5:  # Copyright (c) 2017 The Authors, All Rights Reserved.
    6:  # include_recipe 'aws'
    7:  # include_recipe 'ohai'
    8>> chef_gem 'nokogiri'
    9:  require 'nokogiri'
   10:
   11:  class SolrObject
   12:      attr_reader :coreName
   13:      def initialize(name)
   14:          @coreName = name
   15:      end
   16:
   17:      def coreName

  Platform:
  ---------
  x86_64-linux


  Running handlers:
[2017-03-31T14:07:38+00:00] ERROR: Running exception handlers
  Running handlers complete
[2017-03-31T14:07:38+00:00] ERROR: Exception handlers complete
  Chef Client failed. 0 resources updated in 02 seconds
[2017-03-31T14:07:38+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2017-03-31T14:07:38+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-03-31T14:07:38+00:00] ERROR: chef_gem[nokogiri] (steve-solr::default line 8) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" ----
STDOUT: Building native extensions.  This could take a while...
STDERR: ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    current directory: /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.7.1/ext/nokogiri
/opt/chef/embedded/bin/ruby -r ./siteconf20170331-19864-1d63c49.rb extconf.rb
checking if the C compiler accepts ... *** 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=/opt/chef/embedded/bin/ruby
    --help
    --clean
/opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:582:in `block in try_compile'
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:533:in `with_werror'
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:582:in `try_compile'
    from extconf.rb:138:in `nokogiri_try_compile'
    from extconf.rb:162:in `block in add_cflags'
    from /opt/chef/embedded/lib/ruby/2.1.0/mkmf.rb:630:in `with_cflags'
    from extconf.rb:161:in `add_cflags'
    from extconf.rb:406:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.7.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/nokogiri-1.7.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.7.1/gem_make.out
---- End output of /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" ----
Ran /opt/chef/embedded/bin/gem install nokogiri -q --no-rdoc --no-ri -v "1.7.1" returned 1
[2017-03-31T14:07:38+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

with this being in my error file: 这是在我的错误文件中:

"gcc -o conftest -I/opt/chef/embedded/include/ruby-2.1.0/x86_64-linux -I/opt/chef/embedded/include/ruby-2.1.0/$
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

any help or suggestions on fixing would be fantastic, thanks. 谢谢任何修复方面的帮助或建议。

Just remove the chef_gem entirely. 只需完全删除chef_gem We bundle nokogiri with the Chef installer so you don't have to install or compile it unless you specifically need the latest version for some reason. 我们将nokogiri与Chef安装程序捆绑在一起,因此除非您出于某种原因特别需要最新版本,否则您无需安装或编译它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM