Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

berkshelf install via gem suddenly stopped working #22

Open
adriantaut opened this issue Sep 26, 2023 · 2 comments
Open

berkshelf install via gem suddenly stopped working #22

adriantaut opened this issue Sep 26, 2023 · 2 comments

Comments

@adriantaut
Copy link

Description

Suddently getting this error without changing much in my automation, any thoughts?

[root@ip-10-174-6-204 ~]# chef-client --version
Chef Infra Client: 18.0.185

[root@ip-10-174-6-204 ~]# /opt/chef/embedded/bin/ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]

[root@ip-10-174-6-204 ~]# /opt/chef/embedded/bin/gem -v
3.3.7

[root@ip-10-174-6-204 ~]# /opt/chef/embedded/bin/gem install berkshelf
Building native extensions. This could take a while...
ERROR:  Error installing berkshelf:
	ERROR: Failed to build gem native extension.

    current directory: /opt/chef/embedded/lib/ruby/gems/3.1.0/gems/ffi-1.16.2/ext/ffi_c
/opt/chef/embedded/bin/ruby -I /opt/chef/embedded/lib/ruby/3.1.0 -r ./siteconf20230926-1695-u46cd0.rb extconf.rb
checking for ffi.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_BASE_NAME)
	--with-ffi_c-dir
	--without-ffi_c-dir
	--with-ffi_c-include
	--without-ffi_c-include=${ffi_c-dir}/include
	--with-ffi_c-lib
	--without-ffi_c-lib=${ffi_c-dir}/lib
	--enable-debug
	--disable-debug
	--enable-system-libffi
	--disable-system-libffi
	--with-libffi-dir
	--without-libffi-dir
	--with-libffi-include
	--without-libffi-include=${libffi-dir}/include
	--with-libffi-lib
	--without-libffi-lib=${libffi-dir}/lib
	--with-libffi-config
	--without-libffi-config
	--with-pkg-config
	--without-pkg-config
	--with-ffi-dir
	--without-ffi-dir
	--with-ffi-include
	--without-ffi-include=${ffi-dir}/include
	--with-ffi-lib
	--without-ffi-lib=${ffi-dir}/lib
/opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:509: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/3.1.0/mkmf.rb:635:in `block in try_compile'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:584:in `with_werror'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:635:in `try_compile'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:1171:in `block in have_header'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:1018:in `block in checking_for'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:362:in `block (2 levels) in postpone'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:332:in `open'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:362:in `block in postpone'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:332:in `open'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:358:in `postpone'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:1017:in `checking_for'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:1170:in `have_header'
	from extconf.rb:10:in `system_libffi_usable?'
	from extconf.rb:46: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/3.1.0/extensions/x86_64-linux/3.1.0/ffi-1.16.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/3.1.0/gems/ffi-1.16.2 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/ffi-1.16.2/gem_make.out

thank you!

Berkshelf Version

tried installing v8.0.7 & v8.0.8

Platform Version

CentOS 7

@adriantaut
Copy link
Author

if I am installing libffi-devel the error gets "partially" solved, but still no luck

[root@aws-sgui00 lib]# yum install -y libffi-devel
Loaded plugins: fastestmirror
Repository sensu-checks is listed more than once in the configuration
Repository sensu-nagios is listed more than once in the configuration
Loading mirror speeds from cached hostfile
bf-thirdparty                                                                                    | 1.4 kB  00:00:00
sensu-checks                                                                                     | 1.4 kB  00:00:00
sensu-checks-common                                                                              | 1.4 kB  00:00:00
sensu-go                                                                                         | 1.4 kB  00:00:00
sensu-nagios                                                                                     | 1.4 kB  00:00:00
https://artifactory-prd.prd.betfair/artifactory/thenest/splunk/rpms/noarch/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

sre-tooling                                                                                      | 1.4 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package libffi-devel.x86_64 0:3.0.13-19.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                     Arch                  Version                        Repository                       Size
========================================================================================================================
Installing:
 libffi-devel                x86_64                3.0.13-19.el7                  artifactory-Base                 23 k

Transaction Summary
========================================================================================================================
Install  1 Package

Total download size: 23 k
Installed size: 27 k
Downloading packages:
libffi-devel-3.0.13-19.el7.x86_64.rpm                                                            |  23 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : libffi-devel-3.0.13-19.el7.x86_64                                                                    1/1
  Verifying  : libffi-devel-3.0.13-19.el7.x86_64                                                                    1/1

Installed:
  libffi-devel.x86_64 0:3.0.13-19.el7

Complete!
[root@aws-sgui00 lib]# /opt/chef/embedded/bin/gem install berkshelf
Building native extensions. This could take a while...
ERROR:  Error installing berkshelf:
	ERROR: Failed to build gem native extension.

    current directory: /opt/chef/embedded/lib/ruby/gems/3.1.0/gems/ffi-1.16.2/ext/ffi_c
/opt/chef/embedded/bin/ruby -I /opt/chef/embedded/lib/ruby/3.1.0 -r ./siteconf20230926-15242-i6juyn.rb extconf.rb
*** 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_BASE_NAME)
	--with-ffi_c-dir
	--without-ffi_c-dir
	--with-ffi_c-include
	--without-ffi_c-include=${ffi_c-dir}/include
	--with-ffi_c-lib
	--without-ffi_c-lib=${ffi_c-dir}/lib
	--enable-debug
	--disable-debug
	--enable-system-libffi
	--disable-system-libffi
	--with-libffi-dir
	--without-libffi-dir
	--with-libffi-include
	--without-libffi-include=${libffi-dir}/include
	--with-libffi-lib
	--without-libffi-lib=${libffi-dir}/lib
	--with-libffi-config
	--without-libffi-config
	--with-pkg-config
	--without-pkg-config
/opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:509: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/3.1.0/mkmf.rb:602:in `try_link0'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:620:in `try_link'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:722:in `try_ldflags'
	from /opt/chef/embedded/lib/ruby/3.1.0/mkmf.rb:1906:in `pkg_config'
	from extconf.rb:9:in `system_libffi_usable?'
	from extconf.rb:46: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/3.1.0/extensions/x86_64-linux/3.1.0/ffi-1.16.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/3.1.0/gems/ffi-1.16.2 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/ffi-1.16.2/gem_make.out

@gmahe
Copy link

gmahe commented Dec 13, 2023

in the meantime you can install berk via chef-workstation package.

wget https://packages.chef.io/files/stable/chef-workstation/23.7.1042/ubuntu/22.04/chef-workstation_23.7.1042-1_amd64.deb
sudo dpkg -i chef-workstation_23.7.1042-1_amd64.deb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants