AWS Linux AMI上的Chef构建错误

时间:2015-03-26 23:33:17

标签: linux amazon-web-services amazon-ec2 chef

在过去的几天里,我们有一个以前工作的AWS Cloud Formation,并且相关的Chef脚本开始失败。在这一点上,似乎没有任何可识别的原因。如果有人对潜在原因和/或解决方案有任何见解,我们很乐意听到。以下是来自chef-client.log的错误日志:

[2015-03-26T23:20:31+00:00] INFO: Processing execute[resize2fs /dev/xvda1 2>/dev/null] action run (base::default line 26) [2015-03-26T23:20:31+00:00] INFO: execute[resize2fs /dev/xvda1 2>/dev/null] ran successfully [2015-03-26T23:20:31+00:00] INFO: Processing yum_package[git] action install (base::default line 29) [2015-03-26T23:20:34+00:00] INFO: Processing yum_package[htop] action install (base::default line 30) [2015-03-26T23:20:34+00:00] INFO: yum_package[htop] installing htop-1.0.1-2.3.amzn1 from amzn-main repository [2015-03-26T23:20:38+00:00] INFO: Processing directory[/var/builds/dependencies/] action create (base::common_dependencies line 9) [2015-03-26T23:20:38+00:00] INFO: directory[/var/builds/dependencies/] created directory /var/builds/dependencies/ [2015-03-26T23:20:38+00:00] INFO: Processing s3_file[/var/builds/dependencies/deploy_key] action create (base::common_dependencies line 14) [2015-03-26T23:20:38+00:00] INFO: Processing chef_gem[rest-client] action install (dynamically defined)

================================================================================ Error executing action `install` on resource 'chef_gem[rest-client]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------ Expected process to exit with [0], but received '1'
---- Begin output of /opt/chefdk/embedded/bin/gem install rest-client -q --no-rdoc --no-ri -v "1.8.0" ---- STDOUT: Successfully installed netrc-0.10.3 Building native extensions.  This could take a while... STDERR: WARNING:  You don't have /.chefdk/gem/ruby/2.1.0/bin in your PATH,
          gem executables will not run. ERROR:  Error installing rest-client:
        ERROR: Failed to build gem native extension.

    /opt/chefdk/embedded/bin/ruby -r ./siteconf20150326-4306-ptf6fb.rb extconf.rb checking for main() in -lstdc++... *** 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/chefdk/embedded/bin/ruby
        --with-stdc++lib
        --without-stdc++lib /opt/chefdk/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/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:552:in `try_link0'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:567:in `try_link'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:753:in `try_func'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:984:in `block in have_library'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:929:in `block in checking_for'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:928:in `checking_for'
        from /opt/chefdk/embedded/lib/ruby/2.1.0/mkmf.rb:979:in `have_library'
        from extconf.rb:2:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /.chefdk/gem/ruby/2.1.0/gems/unf_ext-0.0.6 for inspection. Results logged to /.chefdk/gem/ruby/2.1.0/extensions/x86_64-linux/2.1.0/unf_ext-0.0.6/gem_make.out
---- End output of /opt/chefdk/embedded/bin/gem install rest-client -q --no-rdoc --no-ri -v "1.8.0" ---- Ran /opt/chefdk/embedded/bin/gem install rest-client -q --no-rdoc --no-ri -v "1.8.0" returned 1

Cookbook Trace:
--------------- /etc/chef/local-mode-cache/cache/cookbooks/s3_file/providers/default.rb:8:in `block in class_from_file'

Compiled Resource:
------------------
# Declared in

chef_gem("rest-client") do   action :install   retries 0   retry_delay 2   default_guard_interpreter :default   package_name "rest-client"   version "1.8.0"   timeout 900   gem_binary "/opt/chefdk/embedded/bin/gem" end

1 个答案:

答案 0 :(得分:1)

最近更新了rubygem rest-client:

1.8.0 - 2015年3月24日(122 KB)

这为http-cookie gem添加了一个依赖项,它依赖于domain_name,unf和unf_ext,需要一个C ++编译器和libstdc ++(https://github.com/knu/ruby-unf_ext,需求)

对于CentOS,这意味着:yum install gcc-c ++ libstdc ++ - devel

我在他们的错误跟踪器(https://github.com/rest-client/rest-client/issues/371

上创建了一个问题