Vagrant-libvirt: Install problems on Debian

Created on 11 Jun 2015  路  5Comments  路  Source: vagrant-libvirt/vagrant-libvirt

Hi, I'm trying to install on Debian sid, I've installed all these packages:

ruby-dev libxslt-dev libxml2-dev libvirt-dev, libvirt-bin libvirt-dev, ruby2.1-dev

but when I try to install:

micah@muck:bitmask1$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
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:

An error occurred while installing ruby-libvirt (0.5.2), and Bundler cannot continue.
Make sure that `gem install ruby-libvirt -v '0.5.2'` succeeds before bundling.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /opt/vagrant/embedded/bin/ruby 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
    --with-libvirt-include
    --without-libvirt-include
    --with-libvirt-lib
    --without-libvirt-lib
    --with-libvirt-config
    --without-libvirt-config
    --with-pkg-config
    --without-pkg-config
/opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:620:in `block in try_ldflags'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:613:in `with_ldflags'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:619:in `try_ldflags'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:1725:in `pkg_config'
    from extconf.rb:72:in `<main>'


Gem files will remain installed in /home/micah/.vagrant.d/gems/gems/ruby-libvirt-0.5.2 for inspection.
Results logged to /home/micah/.vagrant.d/gems/gems/ruby-libvirt-0.5.2/ext/libvirt/gem_make.out

micah@muck:bitmask1$ 

I followed the instructions which say:

Make sure thatgem install ruby-libvirt -v '0.5.2'succeeds before bundling.

and indeed, it does succeed fine:

root@muck:/home/micah/.vagrant.d# gem install ruby-libvirt -v '0.5.2'
Fetching: ruby-libvirt-0.5.2.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ruby-libvirt-0.5.2
Parsing documentation for ruby-libvirt-0.5.2
Installing ri documentation for ruby-libvirt-0.5.2
Done installing documentation for ruby-libvirt after 1 seconds
1 gem installed
root@muck:/home/micah/.vagrant.d# 

but the vagrant plugin still wont install.

I'll note that the /opt/vagrant/embedded/bin/ruby seems to be 2.0, but I do not have 2.0 development packages available, just 2.1.

Thanks!

Most helpful comment

@pronix I found the issue - it seems that there are a few problems:

  1. debian sid no longer provides ruby2.0 support. When installing vagrant-libvirt it attempts to build against the vagrant ruby environment. If you install the upstream vagrant package (ie. NOT from Debian), then it embeds a ruby environment that is at ruby 2.0 (in /opt), but it doesn't provide the development files for that version, instead you need to install them outside of the vagrant system, such as through the package management on debian. Because Debian sid doesn't include ruby2.0 anymore, and it doesn't include the development libraries, if you install 'ruby-dev' you are getting the development libraries for ruby2.1, which wont work. I find it a bit weird this requirement of mixing the non-distro package with the distro packages, because you can't get this tight coupling of dependency resolution.
  2. You recommend not using vagrant from the official repo. Unfortunately, because of #1 does not work. If I install vagrant from the debian repository, then it provides the correct ruby environment through the dependency management that Debian is known for handling very well, and vagrant-libvirt is able to build fine.
  3. ruby-fog is needed by sahara:
/home/micah/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/session/libvirt.rb:1:in `require': cannot load such file -- fog (LoadError)

this is easy to install and resolved that problem quickly.

All 5 comments

You have to install development tools first.
try to install ruby-libvirt by dpkg or apt-get
may be also missed some dev packages - like ruby-devel or libvirt-devel
as option - use vagrant from official website, not from repo

Hi,

try to install ruby-libvirt by dpkg or apt-get

I did not have ruby-libvirt installed, but installing that did not seem to change the situation.

may be also missed some dev packages - like ruby-devel or libvirt-devel

As I mentioned in the original report, I have already ruby-dev libxslt-dev libxml2-dev libvirt-dev, libvirt-bin libvirt-dev, ruby2.1-dev installed. On debian there is no such thing as 'ruby-devel' or 'libvirt-devel', but I believe that the packages 'libvirt-dev' and 'ruby-dev' are these packages.

as option - use vagrant from official website, not from repo

I am using the vagrant from the official website.

I dont think that this issue is resolved.

@pronix i think you closed the bug too early ! Please have a second look, your suggestions were already satisfied.

@pronix I found the issue - it seems that there are a few problems:

  1. debian sid no longer provides ruby2.0 support. When installing vagrant-libvirt it attempts to build against the vagrant ruby environment. If you install the upstream vagrant package (ie. NOT from Debian), then it embeds a ruby environment that is at ruby 2.0 (in /opt), but it doesn't provide the development files for that version, instead you need to install them outside of the vagrant system, such as through the package management on debian. Because Debian sid doesn't include ruby2.0 anymore, and it doesn't include the development libraries, if you install 'ruby-dev' you are getting the development libraries for ruby2.1, which wont work. I find it a bit weird this requirement of mixing the non-distro package with the distro packages, because you can't get this tight coupling of dependency resolution.
  2. You recommend not using vagrant from the official repo. Unfortunately, because of #1 does not work. If I install vagrant from the debian repository, then it provides the correct ruby environment through the dependency management that Debian is known for handling very well, and vagrant-libvirt is able to build fine.
  3. ruby-fog is needed by sahara:
/home/micah/.vagrant.d/gems/gems/sahara-0.0.17/lib/sahara/session/libvirt.rb:1:in `require': cannot load such file -- fog (LoadError)

this is easy to install and resolved that problem quickly.

regarding the cannot load such file -- fog (LoadError) error, i fixed it on my machine using:

vagrant plugin install fog
Was this page helpful?
0 / 5 - 0 ratings