Problems with Docker / Ruby 2.4.3

663 views
Skip to first unread message

Chris Anthes

unread,
Mar 5, 2018, 10:18:50 AM3/5/18
to nokogiri-talk
I am trying to get nokogiri to install in my Docker image, but I am getting the following error:

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/nokogiri-1.8.2/ext/nokogiri
/usr/local/bin/ruby -r ./siteconf20180305-7-1fctl3m.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>'

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/2.4.0/nokogiri-1.8.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/nokogiri-1.8.2 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.4.0/nokogiri-1.8.2/gem_make.out

I don't have a problem installing nokogiri on my system otherwise. I have tried every potential solution I could find, including using system extensions. I am running macOS 10.13.3 and Docker 17.12.0-ce-mac55. Here is a sample Dockerfile that results in the error above:

FROM ruby:2.4.3

RUN apt-get update -qq && apt-get install -y \
  build-essential \
  patch \
  ruby-dev \
  zlib1g-dev \
  liblzma-dev

RUN gem install nokogiri

Any ideas?

Chris

Mike Dalessio

unread,
Mar 5, 2018, 10:25:34 AM3/5/18
to nokogiri-talk
Hi Chris,

Can I ask if you've checked the installation tutorial at http://nokogiri.org/ ? If you have, that's useful information to know, as it eliminates many possible causes.

Assuming you've read those instructions and they weren't helpful ...

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/2.4.0/nokogiri-1.8.2/mkmf.log
... can you tell us what's in your `mkmf.log` file?

--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-talk+unsubscribe@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Chris Anthes

unread,
Mar 5, 2018, 12:07:35 PM3/5/18
to nokogiri-talk
I will when I can figure out how to view a log file from a stopped container...

*grumbles at the docker gods*

Chris
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.

Chris Anthes

unread,
Mar 5, 2018, 12:17:21 PM3/5/18
to nokogiri-talk
Does this help any?

::::::::::::::
/usr/local/bundle/extensions/x86_64-linux/2.4.0/nokogiri-1.8.2/mkmf.log
::::::::::::::
"gcc -o conftest -I/usr/local/include/ruby-2.4.0/x86_64-linux -I/usr/local/include/ruby-2.4.0/ruby/backward -I/usr/local/include/ruby-2.4.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format  -fPIC  conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lpthread -ldl -lcrypt -lm   -lc "
gcc: internal compiler error: Segmentation fault (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Chris

On Monday, March 5, 2018 at 7:25:34 AM UTC-8, Mike Dalessio wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.

Chris Anthes

unread,
Mar 5, 2018, 12:24:13 PM3/5/18
to nokogiri-talk
For the record, everything works file when using the Ruby 2.4.0 Docker base.

FROM ruby:2.4.0

RUN apt-get update -qq && apt-get install -y \
  build-essential \
  patch \
  ruby-dev \
  zlib1g-dev \
  liblzma-dev

RUN gem install nokogiri

Testing with Ruby 2.4.1 and 2.4.2 now...

Chris

Chris Anthes

unread,
Mar 5, 2018, 12:31:51 PM3/5/18
to nokogiri-talk
No problem building nokogiri with the Ruby 2.4.1 or Ruby 2.4.2 Docker images, either. Appears this is new to the Docker Ruby 2.4.3 base.

I am running Ruby 2.4.3 on my local machine and nokogiri 1.8 is building just fine. Only fails inside the Docker image.

Guess this is just going to be the tone of my week...

Chris

Chris Anthes

unread,
Mar 5, 2018, 12:38:21 PM3/5/18
to nokogiri-talk
The Ruby 2.4.3 Docker image is using RubyGems v2.7.6. Locally, I am only running v2.6.13. I'll check to see if that makes any difference...

Chris

Mike Dalessio

unread,
Mar 8, 2018, 1:27:43 PM3/8/18
to nokogiri-talk
Can I ask if you've reported this to the maintainer of the docker image? It appears as though gcc is crashing due to segfault, and so I don't think there's anything in the Nokogiri codebase or build system that we can do to help ...

--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-talk+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages