mitchellh/vagrant-aws

pkg-config could not be used to find libxml-2.0

valugi opened this issue ยท 5 comments

$ vagrant plugin install vagrant-aws
Installing the 'vagrant-aws' plugin. This can take a few minutes...
Fetching: excon-0.57.1.gem (100%)
Fetching: formatador-0.2.5.gem (100%)
Fetching: fog-core-1.44.3.gem (100%)
Fetching: fog-json-1.0.2.gem (100%)
Fetching: mini_portile2-2.2.0.gem (100%)
Fetching: nokogiri-1.8.0.gem (100%)
Building native extensions. This could take a while...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

ERROR: Failed to build gem native extension.

current directory: /Users/me/.vagrant.d/gems/2.3.4/gems/nokogiri-1.8.0/ext/nokogiri

/opt/vagrant/embedded/bin/ruby -r ./siteconf20170704-26790-w9ybct.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
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.7"

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.7"

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.7"

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
--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=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries=true
--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-pkg-config
--without-pkg-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
--with-pkg-config
--without-pkg-config

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

/Users/me/.vagrant.d/gems/2.3.4/extensions/x86_64-darwin-13/2.3.0/nokogiri-1.8.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/me/.vagrant.d/gems/2.3.4/gems/nokogiri-1.8.0 for inspection.
Results logged to /Users/me/.vagrant.d/gems/2.3.4/extensions/x86_64-darwin-13/2.3.0/nokogiri-1.8.0/gem_make.out

This issue has already been reported here, until the present time it is without solution:
#235

clayg commented

same for me, sudo gem install nokogiri works tho. Oh cool, Vagrant 1.9.5 works fine!

it seems like it is working again in 1.9.7

The solution for me was:
vagrant plugin install pkg-config

Think there is a problem with the path of the ruby gems

vagrant plugin install pkg-config pkg-config
Then, vagrant plugin install vagrant-aws works as charm

Ubuntu 18.04
Vagrant 2.1.2

Thanks!