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

gem install on alpine3.16.1: ERROR: Failed to build gem native extension #606

Open
Poweranimal opened this issue Jul 30, 2022 · 0 comments

Comments

@Poweranimal
Copy link

Hi,

Installing the cfn-nag (v0.8.10) gem on alpine3.16.1 fails with the following error:

ERROR
Building native extensions. This could take a while...
ERROR:  Error installing cfn-nag:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/psych-3.3.2/ext/psych
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.1.0 -r ./siteconf20220730-14-dy0ixb.rb extconf.rb
checking for yaml.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=/usr/local/bin/$(RUBY_BASE_NAME)
        --with-libyaml-dir
        --without-libyaml-dir
        --with-libyaml-include
        --without-libyaml-include=${libyaml-dir}/include
        --with-libyaml-lib
        --without-libyaml-lib=${libyaml-dir}/lib
        --enable-bundled-libyaml
        --disable-bundled-libyaml
/usr/local/lib/ruby/3.1.0/mkmf.rb:498:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:624:in `block in try_compile'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:573:in `with_werror'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:624:in `try_compile'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:1213:in `block in find_header'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:1007:in `block in checking_for'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:362:in `block (2 levels) in postpone'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:332:in `open'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:362:in `block in postpone'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:332:in `open'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:358:in `postpone'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:1006:in `checking_for'
        from /usr/local/lib/ruby/3.1.0/mkmf.rb:1212:in `find_header'
        from extconf.rb:10:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/bundle/extensions/x86_64-linux-musl/3.1.0/psych-3.3.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/psych-3.3.2 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux-musl/3.1.0/psych-3.3.2/gem_make.out

Steps to reproduce

Dockerfile:

FROM docker.io/alpine:3.16.1
RUN apk add --no-cache ruby-dev=3.1.2-r0 &&\
    gem install cfn-nag -v 0.8.10

Run docker build

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

1 participant