hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.25k stars 4.43k forks source link

Nokogiri gem dependancy breaks some plugin installs #6240

Closed ichilton closed 8 years ago

ichilton commented 9 years ago

Looks like dependencies in vagrant 1.7.4 are stopping some plugins installing.

On a clean ArchLinux install:

$ vagrant version
Installed Version: 1.7.4
Latest Version: 1.7.4

You're running an up-to-date version of Vagrant!
$ vagrant plugin install libvirt
Installing the 'libvirt' plugin. This can take a few minutes...
The plugin(s) can't be installed due to the version conflicts below.
This means that the plugins depend on a library version that conflicts
with other plugins or Vagrant itself, creating an impossible situation
where Vagrant wouldn't be able to load the plugins.

You can fix the issue by either removing a conflicting plugin or
by contacting a plugin author to see if they can address the conflict.

Vagrant could not find compatible versions for gem "nokogiri":
  In Gemfile:
    vagrant (= 1.7.4) ruby depends on
      nokogiri (= 1.6.3.1) ruby

    libvirt (>= 0) ruby depends on
      nokogiri (~> 1.4.3) ruby

Is this a plugin maintainers problem, or can it be fixed/worked around from the vagrant side?

Thanks,

Ian

sethvargo commented 8 years ago

Hi @ichilton

This is an issue with the libvirt plugin. Vagrant uses nokogiri internally, and requires a newer version than what the plugin author of libvirt has allowed. Unfortunately Vagrant cannot downgrade. Can you please open an issue with that plugin maintainer? Thanks!

ichilton commented 8 years ago

Hi @sethvargo

I just tried again the other day and with this workaround: https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt it successfully installs now.

Thanks,

Ian

lonniev commented 8 years ago

The workaround from @ichilton is Linux-specific. I have the nokogiri version conflict on MacOs and moving around linux shared libraries won't help vagrant on Mac get around this.

I'll have to go find the hacks for monkey-patching libvirt itself.

lonniev commented 8 years ago

This was a pain to accomplish:

vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Installed the plugin 'vagrant-libvirt (0.0.32)'!

I had to track down the patch for OSX. Then, I built the ruby-libvirt gem for the systemwide gems -- this didn't work. I built it for the embedded gems of vagrant -- this didn't work. Turns out, each user has their own set of vagrant gems as well. I built and installed the patched gem into my local vagrant gem set -- this did work. Geez.

libvirt for OSX can be installed from http://brewformulas.org/Libvirt with:

brew install libvirt

The source for the gemfile is available at https://rubygems.org/gems/ruby-libvirt/versions/0.6.0

The patch for ext/libvirt/extconf.rb is:

# right after the require 'mkmf' line...
$defs.push("-DHAVE_VIRDOMAINQEMUMONITORCOMMAND")

Once the gem is local and patched, cd into its root directory and rake the gem -- but you have to point to where ruby and libvirt are on your particular machine. The following tells the make in the rake where to find the ruby dynamic library and where to find the libvirt headers and library:

CONFIGURE_ARGS="with-opt-lib=/usr/local/lib/ with-libvirt-include=/usr/local/include/ with-libvirt-lib=/usr/local/lib/libvirt" rake -B

Run rake package to bundle up the modified gem.

Once the gem is packaged, the following will install it not into the system set, not into vagrant's embedded set, but into your user's vagrant's set:

CONFIGURE_ARGS="with-opt-lib=/usr/local/lib/ with-libvirt-include=/usr/local/include/ with-libvirt-lib=/usr/local/lib/libvirt" /opt/vagrant/embedded/bin/gem install --local pkg/ruby-libvirt-0.6.0.gem --install-dir /Users/YOURID/.vagrant.d/gems

Then, finally!, you can run the vagrant plugin install vagrant-libvirt command and get success.

Now, I'm off to discover if this hacked up plugin works! ;-)