---
# System prepended metadata

title: 'Problem: unable to install vagrant-libvirt'

---

# Problem: unable to install vagrant-libvirt

## Symptom

```
$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:

ERROR: Failed to build gem native extension.

    current directory: /home/vvv/.vagrant.d/gems/2.6.6/gems/ruby-libvirt-0.7.1/ext/libvirt
/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.6.0 -r ./siteconf20210602-5353-1iyv4l5.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/vvv/.vagrant.d/gems/2.6.6/extensions/x86_64-linux/2.6.0/ruby-libvirt-0.7.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vvv/.vagrant.d/gems/2.6.6/gems/ruby-libvirt-0.7.1 for inspection.
Results logged to /home/vvv/.vagrant.d/gems/2.6.6/extensions/x86_64-linux/2.6.0/ruby-libvirt-0.7.1/gem_make.out
```

## Solution

Use the command from the [Possible problems][] section the of `vagrant-libvirt` README:

```bash
CONFIGURE_ARGS='with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib' \
    GEM_HOME=~/.vagrant.d/gems \
    GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems \
    PATH=/opt/vagrant/embedded/bin:$PATH \
    vagrant plugin install vagrant-libvirt
```

[Possible problems]: https://github.com/vagrant-libvirt/vagrant-libvirt/blob/31cc8aa91ec652d42b4577822a3b665d87db83ee/README.md#possible-problems-with-plugin-installation-on-linux