Nokogiri native build failure upon rails upgrade


#1

In experimenting to resolve another issue, I tried updating our rails application from rail 5.1.4 to 5.1.6 using “bundle update rails”. It all seemed to go well, but afterwards habitat fails to build with the following error:

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

current directory:
/hab/cache/src/active-oversight-api-0.1.2/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.3/ext/nokogiri
/hab/pkgs/core/ruby/2.4.2/20180619210241/bin/ruby -r ./siteconf20180619-26656-v4p3vb.rb extconf.rb
--use-system-libraries
checking if the C compiler accepts -I/hab/pkgs/core/ruby/2.4.2/20180619210241/include
-I/hab/pkgs/core/libxml2/2.9.6/20180608141053/include
-I/hab/pkgs/core/libxslt/1.1.31/20180608141131/include
-I/hab/pkgs/core/postgresql/9.6.8/20180608211535/include
-I/hab/pkgs/core/curl/7.54.1/20180608142121/include
-I/hab/pkgs/finalze/imagemagick/6.9.2-10/20180619190029/include/ImageMagick-6
-I/hab/pkgs/core/file/5.32/20180608050620/include -I/hab/pkgs/core/gcc/7.3.0/20180608051919/include
-I/hab/pkgs/core/make/4.2.1/20180608100733/include -I/hab/pkgs/core/ruby/2.5.1/20180608194604/include...
yes
Building nokogiri using system libraries.
pkg-config could not be used to find libxml-2.0
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libxslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libexslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** 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=/hab/pkgs/core/ruby/2.4.2/20180619210241/bin/$(RUBY_BASE_NAME)
	--help
	--clean
	--use-system-libraries
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--with-xml2-dir
	--without-xml2-dir
	--with-xml2-include
	--without-xml2-include=${xml2-dir}/include
	--with-xml2-lib
	--without-xml2-lib=${xml2-dir}/lib
	--with-libxml-2.0-config
	--without-libxml-2.0-config
	--with-pkg-config
	--without-pkg-config
	--with-xslt-dir
	--without-xslt-dir
	--with-xslt-include
	--without-xslt-include=${xslt-dir}/include
	--with-xslt-lib
	--without-xslt-lib=${xslt-dir}/lib
	--with-libxslt-config
	--without-libxslt-config
	--with-exslt-dir
	--without-exslt-dir
	--with-exslt-include
	--without-exslt-include=${exslt-dir}/include
	--with-exslt-lib
	--without-exslt-lib=${exslt-dir}/lib
	--with-libexslt-config
	--without-libexslt-config

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

/hab/cache/src/active-oversight-api-0.1.2/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.8.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/hab/cache/src/active-oversight-api-0.1.2/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.3 for inspection.
Results logged to
/hab/cache/src/active-oversight-api-0.1.2/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.8.3/gem_make.out

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

In Gemfile:
  zipline was resolved to 1.0.0, which depends on
    rails was resolved to 5.1.6, which depends on
      actioncable was resolved to 5.1.6, which depends on
        actionpack was resolved to 5.1.6, which depends on
          actionview was resolved to 5.1.6, which depends on
            rails-dom-testing was resolved to 2.0.3, which depends on
              nokogiri
   active-oversight-api: Restoring original bundler config
ERROR: bundler returned an error

Attempting to add core/libxml2 or core/libxslt to my package deps results in a dependency graph failure.

here are my build deps

pkg_scaffolding="core/scaffolding-ruby"
pkg_deps=(core/curl finalze/imagemagick core/file)


#2

I’m betting you need to add core/pkg-config to your pkg_deps


#3

And if that doesn’t work, try adding core/libxml2 to your deps as well.


#4

adding just core/pkg-config didn’t help. Adding that and core/libxml2 got me back the to the dependency graph failure:

★ Install of core/libxml2/2.9.6/20180608141053 complete with 0 new packages installed.
   active-oversight-api: Resolved dependency 'core/libxml2' to /hab/pkgs/core/libxml2/2.9.6/20180608141053
   active-oversight-api: WARN 
   active-oversight-api: WARN The following runtime dependencies have more than one version
   active-oversight-api: WARN release in the full dependency chain:
   active-oversight-api: WARN 
   active-oversight-api: WARN   * core/libxml2 ( core/libxml2/2.9.6/20180608141053 core/libxml2/2.9.6/20180608141053 )
   active-oversight-api: WARN 
   active-oversight-api: WARN The current situation usually arises when a Plan has a direct 
   active-oversight-api: WARN dependency on one version of a package (`acme/A/7.0/20160101200001`)
   active-oversight-api: WARN and has a direct dependency on another package which itself depends
   active-oversight-api: WARN on another version of the same package (`acme/A/2.0/20151201060001`).
   active-oversight-api: WARN If this package (`acme/A`) contains shared libraries which are
   active-oversight-api: WARN loaded at runtime by the current Plan, then both versions of
   active-oversight-api: WARN `acme/A` could be loaded into the same process in a potentially
   active-oversight-api: WARN surprising order. Worse, if both versions of `acme/A` are
   active-oversight-api: WARN ABI-incompatible, runtime segmentation faults are more than likely.
   active-oversight-api: WARN 
   active-oversight-api: WARN In order to preserve reliability at runtime the duplicate dependency
   active-oversight-api: WARN entries will need to be resolved before this Plan can be built.
   active-oversight-api: WARN Below is an expanded graph of all `$pkg_deps` and their dependencies
   active-oversight-api: WARN with the problematic lines noted.
   active-oversight-api: WARN 
   active-oversight-api: WARN Computed dependency graph (Lines with '*' denote a problematic entry):

finalze/active-oversight-api/0.1.2/20180619224247
    core/ruby/2.4.2/20180619210241
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/libffi/3.2.1/20180608141245
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/libtool/2.4.6/20180608093951
                core/binutils/2.30/20180608050633
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                    core/zlib/1.2.11/20180608050617
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                core/coreutils/8.29/20180608092141
                    core/acl/2.2.52/20180608091922
                        core/attr/2.4.47/20180608091914
                            core/glibc/2.27/20180608041157
                                core/linux-headers/4.15.9/20180608041107
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/attr/2.4.47/20180608091914
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                    core/gmp/6.1.2/20180608051426
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/libcap/2.25/20180608091936
                        core/attr/2.4.47/20180608091914
                            core/glibc/2.27/20180608041157
                                core/linux-headers/4.15.9/20180608041107
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
                core/grep/3.1/20180608092809
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                    core/pcre/8.41/20180608092740
                        core/gcc-libs/7.3.0/20180608091701
                            core/glibc/2.27/20180608041157
                                core/linux-headers/4.15.9/20180608041107
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                core/sed/4.4/20180608091938
                    core/acl/2.2.52/20180608091922
                        core/attr/2.4.47/20180608091914
                            core/glibc/2.27/20180608041157
                                core/linux-headers/4.15.9/20180608041107
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
        core/libyaml/0.1.6/20180608182021
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/ncurses/6.1/20180608091810
            core/gcc-libs/7.3.0/20180608091701
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/openssl/1.0.2n/20180608102213
            core/cacerts/2018.03.07/20180608102212
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/readline/7.0.3/20180608092900
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/ncurses/6.1/20180608091810
                core/gcc-libs/7.3.0/20180608091701
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    core/libxml2/2.9.6/20180608141053 (*)
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    core/libxslt/1.1.31/20180608141131
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/libxml2/2.9.6/20180608141053 (*)
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    core/postgresql/9.6.8/20180608211535
        core/bash/4.4.19/20180608092913
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/ncurses/6.1/20180608091810
                core/gcc-libs/7.3.0/20180608091701
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/readline/7.0.3/20180608092900
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
                core/ncurses/6.1/20180608091810
                    core/gcc-libs/7.3.0/20180608091701
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
        core/gdal/2.2.1/20180608161339
            core/gcc-libs/7.3.0/20180608091701
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/geos/3.6.2/20180608160941
            core/gcc-libs/7.3.0/20180608091701
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/libossp-uuid/1.6.2/20180608160933
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/libxml2/2.9.6/20180608141053 (*)
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/openssl/1.0.2n/20180608102213
            core/cacerts/2018.03.07/20180608102212
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/perl/5.26.1/20180608094208
            core/bzip2/1.0.6/20180608091727
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/coreutils/8.29/20180608092141
                core/acl/2.2.52/20180608091922
                    core/attr/2.4.47/20180608091914
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/attr/2.4.47/20180608091914
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
                core/gmp/6.1.2/20180608051426
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/libcap/2.25/20180608091936
                    core/attr/2.4.47/20180608091914
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
            core/db/5.3.28/20180608094030
                core/gcc-libs/7.3.0/20180608091701
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/gdbm/1.14.1/20180608094002
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/less/530/20180608094202
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
                core/ncurses/6.1/20180608091810
                    core/gcc-libs/7.3.0/20180608091701
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/pcre/8.41/20180608092740
                    core/gcc-libs/7.3.0/20180608091701
                        core/glibc/2.27/20180608041157
                            core/linux-headers/4.15.9/20180608041107
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/proj/4.9.3/20180608161305
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/readline/7.0.3/20180608092900
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/ncurses/6.1/20180608091810
                core/gcc-libs/7.3.0/20180608091701
                    core/glibc/2.27/20180608041157
                        core/linux-headers/4.15.9/20180608041107
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    core/busybox-static/1.28.1/20180608102729
    core/curl/7.54.1/20180608142121
        core/cacerts/2018.03.07/20180608102212
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/nghttp2/1.31.0/20180608142107
        core/openssl/1.0.2n/20180608102213
            core/cacerts/2018.03.07/20180608102212
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    finalze/imagemagick/6.9.2-10/20180619190029
        core/gcc-libs/7.3.0/20180608091701
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/libjpeg-turbo/1.5.0/20180608183037
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/libpng/1.6.21/20180608142039
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
            core/zlib/1.2.11/20180608050617
                core/glibc/2.27/20180608041157
                    core/linux-headers/4.15.9/20180608041107
        core/xz/5.2.3/20180608100110
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    core/file/5.32/20180608050620
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107
    core/pkg-config/0.29.2/20180608091734
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
    core/libxml2/2.9.6/20180608141053 (*)
        core/glibc/2.27/20180608041157
            core/linux-headers/4.15.9/20180608041107
        core/zlib/1.2.11/20180608050617
            core/glibc/2.27/20180608041157
                core/linux-headers/4.15.9/20180608041107

ERROR: Computed runtime dependency check failed, aborting

Which seems odd since it seems to be conflicting with itself at the same version.


#5

Interesting! Taking a closer look.


#6

What does you pkg_deps and pkg_build_deps look like now?


#7

I’ve replicated this issue, it’s definitely a bug. Opening an issue for this. Is this blocking you right now, or can it wait for our normal issue triage?


#8

Issue created - moving discussion there https://github.com/habitat-sh/core-plans/issues/1599


#9

Normal triage would be fine Since I’m not having to do the upgrade right now.


#10

hello I am also seeing this issue. I tried building one of my apps this morning (which was working previously) but now I am seeing an error saying core/glibc and core/linux-headers have more than one version. This error appears when attempting to install core/coreutils in pkg_deps.


#11

That sounds like it might be a different problem, since you refer to packages that aren’t in my plan at all. These problems arise from specific package combinations, and so if your combination is different, it needs to be managed / investigated on it’s own.

Unless you are seeing precisely the dependency graph failure I posted above concerning core/libxml2, or the build failure with nokogiri, could you start a new topic and paste in your pkg_dep lines from your plan and the dependency graph there?

Thanks!