Сбой установки шеф-повара ruby ​​gem

Я пытаюсь настроить cassandra на виртуальной машине CentOS через шеф-повара, и это не удается с ошибкой ниже. Я безуспешно пытался очистить кеши пакетов. Рецепт работает на другой машине, но ключевое отличие состоит в том, что я заранее запускал другие рецепты на этой машине, поэтому я подозреваю, что мне не хватает зависимости от шеф-повара (поэтому я не пытался просто исправить пакеты напрямую). Я также ужасно новичок в рубине, поэтому извините, если это очевидный вопрос.

Конфигурация машины

  • Шеф-повар: 11.4.0
  • рубин 1.9.3p286 (2012-10-12 редакция 37165) [x86_64-linux]
  • драгоценный камень 1.8.24
  • Linux somehost 2.6.32-276.el6.x86_64 #1 SMP Вт, 29 мая, 17:38:19 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

Сообщения об ошибках вывода шеф-клиента:

Starting Chef Client, version 11.4.0
    resolving cookbooks for run list: ["chef-client", "cassandra"]
    Synchronizing Cookbooks:
      - minitest-handler
      - chef_handler
      - yum
      - cron
      - selinux
      - sysctl
      - openssh
      - iptables
      - chef-client
      - cassandra
      - apt
      - java
      - windows
      - aws
    Compiling Cookbooks...
    Recipe: cassandra::packages
      * chef_gem[cassandra-cql] action install
    ================================================================================
    Error executing action `install` on resource 'chef_gem[cassandra-cql]'
    ================================================================================
 Gem::Installer::ExtensionBuildError
    -----------------------------------
    ERROR: Failed to build gem native extension.

    /opt/chef/embedded/bin/ruby extconf.rb
    extconf.rb:25: Use RbConfig instead of obsolete and deprecated Config.
    checking for strlcpy() in string.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=/opt/chef/embedded/bin/ruby
    /opt/chef/embedded/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 /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
        from extconf.rb:29:in `<main>'


    Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/thrift-0.9.1 for inspection.
    Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/thrift-0.9.1/ext/gem_make.out



    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:30:in `block in from_file'
    /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:29:in `each'
    /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:29:in `from_file'
    /var/chef/cache/cookbooks/cassandra/recipes/default.rb:23:in `from_file'


    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/cassandra/recipes/packages.rb

     30:   chef_gem pkg do
     31:     action :install
     32:     version attrs["version"] if attrs["version"]
     33:   end
     34: end



    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:30:in `block in from_file'

    chef_gem("cassandra-cql") do
      provider Chef::Provider::Package::Rubygems
      action [:install]
      retries 0
      retry_delay 2
      package_name "cassandra-cql"
      version "1.1.4"
      cookbook_name "cassandra"
      recipe_name "packages"
    end


    ================================================================================
    Recipe Compile Error in /var/chef/cache/cookbooks/cassandra/recipes/default.rb
    ================================================================================


    Gem::Installer::ExtensionBuildError
    -----------------------------------
    chef_gem[cassandra-cql] (cassandra::packages line 30) had an error: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

            /opt/chef/embedded/bin/ruby extconf.rb
    extconf.rb:25: Use RbConfig instead of obsolete and deprecated Config.
    checking for strlcpy() in string.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=/opt/chef/embedded/bin/ruby
    /opt/chef/embedded/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 /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
        from extconf.rb:29:in `<main>'


    Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/thrift-0.9.1 for inspection.
    Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/thrift-0.9.1/ext/gem_make.out



    Cookbook Trace:
    ---------------
      /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:30:in `block in from_file'
      /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:29:in `each'
      /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:29:in `from_file'
      /var/chef/cache/cookbooks/cassandra/recipes/default.rb:23:in `from_file'


    Relevant File Content:
    ----------------------
    /var/chef/cache/cookbooks/cassandra/recipes/packages.rb:

     23:    package pkg do
     24:      action :install
     25:      version attrs["version"] if attrs["version"]
     26:    end
     27:  end
     28:  
     29:  node["cassandra"]["chef_gems"].each do |pkg, attrs|
     30>>   chef_gem pkg do
     31:      action :install
     32:      version attrs["version"] if attrs["version"]
     33:    end
     34:  end
     35:  
     36:  # Some distributed packages of Cassandra start the service in their
     37:  # postinstall; keep them all equal and a restart can be done after the configs
     38:  # are written on the first run. Added difficulty: they also come with init
     39:  # scripts that always exit 0.



    [2013-10-11T13:13:42-04:00] ERROR: Running exception handlers
    [2013-10-11T13:13:42-04:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
    [2013-10-11T13:13:42-04:00] ERROR: Exception handlers complete
    Chef Client failed. 0 resources updated
    [2013-10-11T13:13:42-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    [2013-10-11T13:13:42-04:00] FATAL: Gem::Installer::ExtensionBuildError: chef_gem[cassandra-cql] (cassandra::packages line 30) had an error: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

            /opt/chef/embedded/bin/ruby extconf.rb
    extconf.rb:25: Use RbConfig instead of obsolete and deprecated Config.
    checking for strlcpy() in string.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=/opt/chef/embedded/bin/ruby
    /opt/chef/embedded/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 /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
        from extconf.rb:29:in `<main>'</pre>


    Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/thrift-0.9.1 for inspection.
    Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/thrift-0.9.1/ext/gem_make.out

person travelingsultan    schedule 11.10.2013    source источник


Ответы (1)


Компилятору не удалось сгенерировать исполняемый файл. (RuntimeError)
Сначала необходимо установить средства разработки.

Приведенная выше ошибка заставляет меня поверить, что вам нужно установить пакеты ruby-dev и gcc на вашу CentOS. На моей Ubuntu 10.04 я установил следующие пакеты: ruby1.9.1-dev и gcc-4.4.

Не могли бы вы попробовать установить аналогичные пакеты на CentOS, а затем повторно запустить шеф-повар?

person slayedbylucifer    schedule 11.10.2013
comment
Спасибо, это действительно решает проблему. Мне все еще нужно увидеть, какая зависимость шеф-повара сделает это автоматически. - person travelingsultan; 12.10.2013
comment
Если кому-то это нужно, это то, что я запустил вручную yum install gcc gcc-c++ ruby-devel - person travelingsultan; 12.10.2013
comment
Приведенный выше комментарий исправил проблему, из-за которой я получал ту же ошибку при использовании gem_package на centos 6. Спасибо! - person tylerthemiler; 28.11.2013
comment
Вы хотите использовать поваренную книгу сборки и установить node['build_essential']['compiletime'] на true - person Holger Just; 18.01.2014
comment
@slayedbylucifer: Не могли бы вы уточнить, какие зависимости необходимо разрешить? - person Megha Sharma; 09.06.2014
comment
Я выполнил эту команду: 'yum install ruby ​​ruby-devel ruby-ri ruby-rdoc rubygem-chef gcc gcc-c++ automake autoconf make curl dmidecode and gem install chef --no-ri --no-rdoc`. Я все еще получаю сообщение об ошибке - person Megha Sharma; 09.06.2014
comment
То же самое для меня =( Build-essential вообще не помог. - person holms; 24.06.2014