'Error installing vagrant-libvirt plugin on OS X
I'm getting started with Vagrant on OSX (Intel) and I really don't want to use VirtualBox, so I'm trying to use Qemu instead.
I'm having some difficulties installing vagrant-libvirt plugin; here are the steps I have followed so far (from this post)
install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"install Qemu
brew install qemuinstall Vagrant
brew install --cask vagrant && \ brew install libiconv gcc libvirtupdate path
echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.zshrc && \ echo 'export LDFLAGS="-L/usr/local/opt/libiconv/lib"' >> ~/.zshrc && \ echo 'export CPPFLAGS="-I/usr/local/opt/libiconv/include"' >> ~/.zshrc && \ echo 'export VAGRANT_DEFAULT_PROVIDER=kvm' >> ~/.zshrcinstall vagrant-libvirt
- find out
ruby version
➜ ~ /opt/vagrant/embedded/bin/ruby --version ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin19]- vagrant plugin install vagrant-libvirt
(also triedGEM_HOME=~/.vagrant.d/gems/2.7.4)
CONFIGURE_ARGS='with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/usr/local/include/libvirt with-libvirt-lib=/usr/local/lib' \ GEM_HOME=~/.vagrant.d/gems/2.7.4p191 \ GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems \ PATH=/opt/vagrant/embedded/bin:$PATH \ vagrant plugin install vagrant-libvirt- find out
error
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
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: /Users/francesco/.vagrant.d/gems/2.7.4/gems/ruby-libvirt-0.8.0/ext/libvirt
/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.7.0 -r ./siteconf20220306-10299-t8kkrg.rb extconf.rb
Looking for libvirt in /usr/local/include/libvirt and /usr/local/lib
checking for virConnectOpen() in -lvirt... no
*** 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
--with-libvirt-lib
--with-virt-dir
--without-virt-dir
--with-virt-include
--without-virt-include=${virt-dir}/include
--with-virt-lib
--without-virt-lib=${virt-dir}/lib
--with-virtlib
--without-virtlib
extconf.rb:44:in `<main>': No working libvirt installation found (RuntimeError)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/francesco/.vagrant.d/gems/2.7.4/extensions/x86_64-darwin-19/2.7.0/ruby-libvirt-0.8.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/francesco/.vagrant.d/gems/2.7.4/gems/ruby-libvirt-0.8.0 for inspection.
Results logged to /Users/francesco/.vagrant.d/gems/2.7.4/extensions/x86_64-darwin-19/2.7.0/ruby-libvirt-0.8.0/gem_make.out
Besides fixing the error, I wonder, is there an easier way to set up vagrant with Qemu on OSX?
Solution 1:[1]
Step 1:
brew install qemu gcc libvirt.
Step 2:
echo 'security_driver = "none"' >> /usr/local/etc/libvirt/qemu.conf
echo "dynamic_ownership = 0" >> /usr/local/etc/libvirt/qemu.conf
echo "remember_owner = 0" >> /usr/local/etc/libvirt/qemu.conf
If that doesn't work for you, try this tutorial together with this one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | halfer |
