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

[1.10.6] Error occurred while installing nokogiri #1954

Closed
artplan1 opened this issue Dec 4, 2019 · 5 comments
Closed

[1.10.6] Error occurred while installing nokogiri #1954

artplan1 opened this issue Dec 4, 2019 · 5 comments

Comments

@artplan1
Copy link

artplan1 commented Dec 4, 2019

Hello,
we're having trouble to install 1.10.6 in ruby:2.6.5-slim docker image

I see an issue when new patch is applied. Some paths were changed in 1.10.6

root@0f9e302639b8:/app# cat /usr/local/bundle/gems/nokogiri-1.10.6/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10/patch.log

patching file HTMLtree.c
Hunk #1 succeeded at 706 (offset -11 lines).
patching file entities.c
patching file entities.c
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- Makefile.in.orig   2019-12-04 06:31:23.930568000 +0900
|+++ Makefile.in        2019-12-04 06:31:26.838389000 +0900
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored

What is the complete output of gem install?

Fetching nokogiri 1.10.6
Installing nokogiri 1.10.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/nokogiri-1.10.6/ext/nokogiri
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.6.0 -r ./siteconf20191204-1216-1iis1sv.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
        - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
        - 0002-Remove-script-macro-support.patch
        - 0003-Update-entities-to-remove-handling-of-ssi.patch
        - 0004-libxml2.la-is-in-top_builddir.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.10.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10... OK
Running patch with /usr/local/bundle/gems/nokogiri-1.10.6/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running patch with /usr/local/bundle/gems/nokogiri-1.10.6/patches/libxml2/0002-Remove-script-macro-support.patch... OK
Running patch with /usr/local/bundle/gems/nokogiri-1.10.6/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK
Running patch with /usr/local/bundle/gems/nokogiri-1.10.6/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch... ERROR, review
'/usr/local/bundle/gems/nokogiri-1.10.6/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10/patch.log' to see what happened. Last lines are:
========================================================================
patching file HTMLtree.c
Hunk #1 succeeded at 706 (offset -11 lines).
patching file entities.c
patching file entities.c
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- Makefile.in.orig   2019-12-04 06:31:23.930568000 +0900
|+++ Makefile.in        2019-12-04 06:31:26.838389000 +0900
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored
========================================================================
*** 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
        --use-system-libraries
        --enable-static
        --disable-static
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --enable-cross-build
        --disable-cross-build
/usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:402:in `block in execute': Failed to complete patch task (RuntimeError)
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in `chdir'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in `execute'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:81:in `block in apply_patch'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:86:in `apply_patch'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:92:in `block in patch'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:90:in `each'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:90:in `patch'
        from /usr/local/bundle/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:152:in `cook'
        from extconf.rb:365:in `block (2 levels) in process_recipe'
        from extconf.rb:257:in `block in chdir_for_build'
        from extconf.rb:256:in `chdir'
        from extconf.rb:256:in `chdir_for_build'
        from extconf.rb:364:in `block in process_recipe'
        from extconf.rb:262:in `tap'
        from extconf.rb:262:in `process_recipe'
        from extconf.rb:557: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.6.0/nokogiri-1.10.6/mkmf.log

extconf failed, exit code 1

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

An error occurred while installing nokogiri (1.10.6), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.6' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 6.0.1, which depends on
    actioncable was resolved to 6.0.1, which depends on
      actionpack was resolved to 6.0.1, which depends on
        actionview was resolved to 6.0.1, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri

What are the complete contents of the mkmf.log file generated during the failed installation?

"gcc -o conftest -I/usr/local/include/ruby-2.6.0/x86_64-linux -I/usr/local/include/ruby-2.6.0/ruby/backward -I/usr/local/include/ruby-2.6.0 -I.    -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC  conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm   -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -I/usr/local/include/ruby-2.6.0/x86_64-linux -I/usr/local/include/ruby-2.6.0/ruby/backward -I/usr/local/include/ruby-2.6.0 -I.    -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC    -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

have_library: checking for gzdopen() in -lz... -------------------- yes

"gcc -o conftest -I/usr/local/include/ruby-2.6.0/x86_64-linux -I/usr/local/include/ruby-2.6.0/ruby/backward -I/usr/local/include/ruby-2.6.0 -I.    -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby -lz  -lm   -lc "
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <zlib.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     int (* volatile tp)(void)=(int (*)(void))&t;
11:     printf("%d", (*tp)());
12:   }
13: 
14:   return 0;
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))gzdopen; return !p; }
/* end */

--------------------

have_iconv?: checking for iconv... -------------------- yes

"gcc -o conftest -I/usr/local/include/ruby-2.6.0/x86_64-linux -I/usr/local/include/ruby-2.6.0/ruby/backward -I/usr/local/include/ruby-2.6.0 -I.    -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm   -lc "
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: 
 6: int main(void)
 7: {
 8:     iconv_t cd = iconv_open("", "");
 9:     iconv(cd, NULL, NULL, NULL, NULL);
10:     return EXIT_SUCCESS;
11: }
/* end */

--------------------

What operating system are you using?

Linux, ruby:2.6.5-slim docker image

@mmoll
Copy link

mmoll commented Dec 4, 2019

The same seems to happen on Debian/buster.

@flavorjones
Copy link
Member

OK, thanks for reporting this, will take a look.

@flavorjones
Copy link
Member

flavorjones commented Dec 4, 2019

OK, I see the problem: on systems that don't have git installed, mini_portile2 will fall back to using patch to apply patches. You're seeing an error due to differences in how git and patch handle this patch.

Should have a patched version released in the next few hours. Sorry for the hassle.

@artplan1
Copy link
Author

artplan1 commented Dec 4, 2019

thanks @flavorjones for the quick fix 🚀

@flavorjones
Copy link
Member

Once this fix gets through CI (see https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri-v1.10.x) I'll cut v1.10.7.

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

3 participants