chef: Unable to install gem using the chef-infra-client v17.6.18
Unable to install gem using the chef-infra-client v17.6.18
I am trying to install this gem below with the latest version of chef-client v17.6.18 using the below code block in my recipe. But getting error while installing the gem. Since my VM doesn’t have internet connection, I have to update my gem source to my local repo in artifactory instead of the default rubygems URL (https://rubygems.org). But while deployment it is still trying to look in the rubygems URL which it shouldn’t. Infact older version of chef-client (v15.13.8) did work fine i.e., it installs the gem from my artifactory repo.
I tried to use clear_sources true and source https://local-artifactory-gem-repo as well with chef_gem resource. But still the same error. This time I could see the artifactory-local-gem-repo as my source repo.
chef_gem 'tiny_tds' do
action :install
end
Software Version
chef-infra-client v17.6.18
OS Win2019
Stacktrace
[2021-10-07T13:09:37-04:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2021-10-07T13:09:37-04:00] FATAL: ---------------------------------------------------------------------------------------
[2021-10-07T13:09:37-04:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2021-10-07T13:09:37-04:00] FATAL: ---------------------------------------------------------------------------------------
[2021-10-07T13:09:37-04:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: chef_gem[tiny_tds] (COOKBOOK_NAME::RECIPE_NAME line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of C:/opscode/chef/embedded/bin/gem install tiny_tds -q --no-document -v "2.1.5" --source=https://rubygems.org ----
STDOUT: Building native extensions. This could take a while...
STDERR: ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
current directory: C:/opscode/chef/embedded/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds
C:/opscode/chef/embedded/bin/ruby.exe -I C:/opscode/chef/embedded/lib/ruby/3.0.0 -r ./siteconf20211007-356-j4rum4.rb extconf.rb
looking for freetds headers in the following directories:
- /opt/local/include
- /opt/local/include/freetds
- /usr/local/include
- /usr/local/include/freetds
looking for freetds library in the following directories:
- /opt/local/lib
- /opt/local/lib/freetds
- /usr/local/lib
- /usr/local/lib/freetds
checking for sybfront.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
--without-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=C:/opscode/chef/embedded/bin/$(RUBY_BASE_NAME)
--help
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/lib
C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:482:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:624:in `try_cpp'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:1188:in `block in find_header'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:982:in `block in checking_for'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:361:in `block (2 levels) in postpone'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:361:in `block in postpone'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:331:in `open'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:357:in `postpone'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:981:in `checking_for'
from C:/opscode/chef/embedded/lib/ruby/3.0.0/mkmf.rb:1187:in `find_header'
from extconf.rb:59:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/opscode/chef/embedded/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/tiny_tds-2.1.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/opscode/chef/embedded/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5 for inspection.
Results logged to C:/opscode/chef/embedded/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/tiny_tds-2.1.5/gem_make.out
---- End output of C:/opscode/chef/embedded/bin/gem install tiny_tds -q --no-document -v "2.1.5" --source=https://rubygems.org ----
Ran C:/opscode/chef/embedded/bin/gem install tiny_tds -q --no-document -v "2.1.5" --source=https://rubygems.org returned 1
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 40 (22 by maintainers)
Apologies for leaving this dangling. I’ll get some cycles in a couple of days and give this an update.
On understanding the impact of reverting the change, we spent time in fixing the underlying issue causing the builds to fail. Thank you for bringing it to our attention and your understanding. https://github.com/chef/chef/pull/13097
Lemme see if I can find it.
@floh96 thanks, that is indeed step 1. that I executed to overcome one issue, however then I’m facing the issue as mentioned in my last comment.