【问题标题】:Chef build error on AWS Linux AMIAWS Linux AMI 上的 Chef 构建错误
【发布时间】:2015-03-27 17:07:13
【问题描述】:

在过去的几天里,我们之前工作的 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

【问题讨论】:

  • 失败的是使用 restclient gem 进行编译:*** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. 我会看看mkmf.log 看看有什么问题,也许不是所有需要的 lib 头文件都可用...

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


【解决方案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) 上创建了一个问题

【讨论】:

  • 这当然可以解决。希望这会得到解决,这样我们的服务器上就不需要开发工具了。感谢您的帮助!
猜你喜欢
  • 2021-06-08
  • 2011-12-28
  • 2018-11-22
  • 2017-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-17
  • 2020-05-19
相关资源
最近更新 更多