Vagrant-libvirt: Cant install plugin on Ubuntu 16.04 with Vagrant 2.1.1

Created on 8 May 2018  路  1Comment  路  Source: vagrant-libvirt/vagrant-libvirt

Steps to reproduce

  1. Install vagrant from deb on Vagrant website
  2. Install deps:
    sudo apt-get install qemu libvirt-bin ebtables dnsmasq sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
  3. Install plugin:
    vagrant plugin install vagrant-libvirt

    Expected behaviour

vagrant-libvirt should be successfully installed.

Actual behaviour

$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
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: /home/user/.vagrant.d/gems/2.4.4/gems/ruby-libvirt-0.7.1/ext/libvirt
/opt/vagrant/embedded/bin/ruby -r ./siteconf20180507-27548-1d1vhbt.rb extconf.rb
*** 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)
    --with-libvirt-include
    --without-libvirt-include
    --with-libvirt-lib
    --without-libvirt-lib
    --with-libvirt-config
    --without-libvirt-config
    --with-pkg-config
    --without-pkg-config
extconf.rb:73:in `<main>': libvirt library not found in default locations (RuntimeError)

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

  /home/user/.vagrant.d/gems/2.4.4/extensions/x86_64-linux/2.4.0/ruby-libvirt-0.7.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/user/.vagrant.d/gems/2.4.4/gems/ruby-libvirt-0.7.1 for inspection.
Results logged to /home/user/.vagrant.d/gems/2.4.4/extensions/x86_64-linux/2.4.0/ruby-libvirt-0.7.1/gem_make.out
$ cat /home/user/.vagrant.d/gems/2.4.4/extensions/x86_64-linux/2.4.0/ruby-libvirt-0.7.1/mkmf.log
"pkg-config --exists libvirt"
package configuration for libvirt is not found

System configuration

OS/Distro version::
Ubuntu 16.04 64bit

Libvirt version:

$ dpkg -l *libvirt*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                           Version                      Architecture                 Description
+++-==============================================-============================-============================-==================================================================================================
ii  gir1.2-libvirt-glib-1.0:amd64                  0.2.2-0.1ubuntu1             amd64                        libvirt glib mainloop integration
ii  libvirt-bin                                    1.3.1-1ubuntu10.22           amd64                        programs for the libvirt library
un  libvirt-daemon                                 <none>                       <none>                       (no description available)
un  libvirt-daemon-system                          <none>                       <none>                       (no description available)
ii  libvirt-dev:amd64                              1.3.1-1ubuntu10.22           amd64                        development files for the libvirt library
ii  libvirt-glib-1.0-0:amd64                       0.2.2-0.1ubuntu1             amd64                        libvirt glib mainloop integration
ii  libvirt0:amd64                                 1.3.1-1ubuntu10.22           amd64                        library for interfacing with different virtualization systems
ii  munin-libvirt-plugins                          0.0.6-1                      all                          Munin plugins using libvirt
ii  python-libvirt                                 1.3.1-1ubuntu1.1             amd64                        libvirt Python bindings

Output of vagrant version; vagrant plugin list:

$ vagrant version; vagrant plugin list
Installed Version: 2.1.1
Latest Version: 2.1.0

You're running an up-to-date version of Vagrant!
vagrant-aws (0.7.2)

Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt

N/A

A Vagrantfile to reproduce the issue:

N/A

Are you using upstream vagrant package or your distros package?
Upstream

Most helpful comment

Closing, I got it working with the following:

CONFIGURE_ARGS="with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib" vagrant plugin install vagrant-libvirt

>All comments

Closing, I got it working with the following:

CONFIGURE_ARGS="with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib" vagrant plugin install vagrant-libvirt
Was this page helpful?
0 / 5 - 0 ratings