Skip to content

bundle install fails on ruby:2.4.4-alpine3.7 when gems have native extensions #221

@unikitty37

Description

@unikitty37

When I try running bundle install on a Docker image derived from ruby:2.4.4-alpine3.7, it fails when it reaches a gem that has native extensions (for example, Nokogiri).

Indeed, if I run docker run -it ruby:2.4.4-alpine3.7 sh and type make, I get sh: make: not found.

Would it be possible for the images to include the necessary build tools? (And, as a short-term fix, could somebody please tell me the Alpine equivalent of Ubuntu's build-essentials package so I can get GitLab's CI set up and working? :)

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/builds/project/test-project/cache/ruby/2.4.0/gems/nokogiri-1.8.2/ext/nokogiri
/usr/local/bin/ruby -r ./siteconf20180621-14-1p1kra6.rb extconf.rb
checking if the C compiler accepts ... *** 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)
	--help
	--clean
/usr/local/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to
generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/local/lib/ruby/2.4.0/mkmf.rb:572:in `block in try_compile'
	from /usr/local/lib/ruby/2.4.0/mkmf.rb:523:in `with_werror'
	from /usr/local/lib/ruby/2.4.0/mkmf.rb:572:in `try_compile'
	from extconf.rb:138:in `nokogiri_try_compile'
	from extconf.rb:162:in `block in add_cflags'
	from /usr/local/lib/ruby/2.4.0/mkmf.rb:630:in `with_cflags'
	from extconf.rb:161:in `add_cflags'
	from extconf.rb:410:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions