Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to install with error: "No working libvirt installation found" #1671

Closed
iapicca opened this issue Nov 11, 2022 · 4 comments
Closed

fail to install with error: "No working libvirt installation found" #1671

iapicca opened this issue Nov 11, 2022 · 4 comments

Comments

@iapicca
Copy link

iapicca commented Nov 11, 2022

I'm encountering the error below when running vagrant plugin install vagrant-libvirt

setup

  1. install homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. install in homebrew

    brew install --cask vagrant && \
    brew install make gcc qemu libiconv libvirt
  3. double check libvirt path

~ brew --prefix libvirt
/opt/homebrew/opt/libvirt

update path

HOMEBREW_HOME="/opt/homebrew/opt"
LIBICONV_HOME="$HOMEBREW_HOME/libiconv"

export PATH="$LIBICONV_HOME/bin:$PATH"
export PATH="$HOMEBREW_HOME/make/libexec/gnubin:$PATH"
export LDFLAGS="-L$LIBICONV_HOME/lib"
export CPPFLAGS="-I$LIBICONV_HOME/include"
export CONFIGURE_ARGS="with-libvirt-lib=$(brew --prefix libvirt)/lib with-libvirt-include=$(brew --prefix libvirt)/include"

error

~ vagrant plugin install vagrant-libvirt

Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Fetching formatador-1.1.0.gem
Fetching fog-core-2.3.0.gem
Fetching fog-json-1.2.0.gem
Fetching nokogiri-1.13.9-x86_64-darwin.gem
Fetching fog-xml-0.1.4.gem
Fetching ruby-libvirt-0.8.0.gem
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/yakforward/.vagrant.d/gems/2.7.6/gems/ruby-libvirt-0.8.0/ext/libvirt
/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.7.0 -r ./siteconf20221111-11883-1v7zec5.rb extconf.rb
Looking for libvirt in /opt/homebrew/opt/libvirt/include and /opt/homebrew/opt/libvirt/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/yakforward/.vagrant.d/gems/2.7.6/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/yakforward/.vagrant.d/gems/2.7.6/gems/ruby-libvirt-0.8.0 for inspection.
Results logged to /Users/yakforward/.vagrant.d/gems/2.7.6/extensions/x86_64-darwin-19/2.7.0/ruby-libvirt-0.8.0/gem_make.out
info
~ neofetch
                    'c.          [email protected]
                 ,xNMM.          ---------------------------
               .OMMMMo           OS: macOS 13.0.1 22A400 arm64
               OMMM0,            Host: MacBookAir10,1
     .;loddo:' loolloddol;.      Kernel: 22.1.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 53 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 89 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8.1
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1440x900
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: iTerm2
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: Monaco 12
    kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Apple M1
     ;KMMMMMMMWXXWMMMMMMMk.      GPU: Apple M1
       .cooc,.    .,coo:.        Memory: 1129MiB / 8192MiB
~  vagrant --version
Vagrant 2.3.2

logs

mkmf.log
gem_make.out.zip

related issues:

#497
#818
#1017
#1461 (my own) cc @electrofelix

mirror:
stackoverflow

@electrofelix
Copy link
Contributor

The vagrant package installed is for x86_64 architecture
https://github.com/Homebrew/homebrew-cask/blob/73c9b82e1901915d077a8130275aa8bfd66e2484/Casks/vagrant.rb#L5

When you brew install libvirt it will be for the m1 arm64 architecture, so it's not possible to link between the x86_64 ruby in vagrant and the arm64 libraries such as libvirt.

The only option is to do brew install of ruby and then a bundle install of vagrant until such stage as either vagrant-libvirt doesn't need ruby-libvirt or hashicorp supply an arm64 binary package of vagrant.

@iapicca
Copy link
Author

iapicca commented Nov 11, 2022

first of all thank you @electrofelix for replying so quickly

The vagrant package installed is for x86_64 architecture

I though rosetta would take care of this,
(also worked with vagrant-qemu, but has other problems)

how do I install the arm version for vagrant,
there must be some way since it works w/ vmware (and qemu in part)?

@electrofelix
Copy link
Contributor

AFAIK, there is no pre built vagrant package for Mac arm64.

I believe the interface to both VMWare and QEMU is by calling the CLI directly with specific arguments. This avoids issues around architecture because they are not directly needing to access the libraries of the other application. Unfortunately, since this project depends on fog-libvirt and ruby-libvirt (which made sense to not have to model everything) it requires being able to link against libvirt and that has caused quite a few problems over time. While some progress is being made, it'll take a while to resolve fully.

The options effectively become limited to using brew to install ruby and libvirt, and then using bundle install (I'm assuming that installing ruby will include rubygems bundle, it might be a separate step though) on a clone of this project to install vagrant and vagrant-libvirt directly from ruby. This should mean that the ruby being used is then arm64 which would be the same architecture as the libvirt libraries, and that would allow compiling ruby-libvirt to provide the ruby API bindings needed. Running would then become bundle exec vagrant up --provider libvirt. There are additional calls you can make to bundle to make the installed scripts available without needing to use bundle exec ... but it's probably worth checking that what it provides works before worrying about that.

However it's not necessarily going to work because vagrant-libvirt currently has a dependency on being able to create a management network, and I'm not sure that libvirt on Mac supports that capability yet. https://gitlab.com/libvirt/libvirt/-/issues/75 suggests it's not yet there.

I am hopeful over the next couple of months to work on using qemu/libvirt's port forwarding capabilities to remove the need for the dedicated management network, though if you need a network for something else, that won't help much.

@electrofelix
Copy link
Contributor

Going to close this in favour of tracking all the issues with installing on arm64 for MacOS under #1205, a comment on that issue suggests a possible workaround for now #1205 (comment) and there is another issue #1703 covers using vmnet to create networks, which should be possible to be reference now due to the addition of the management_network_iface_name option (provided you don't use vnetX as the device naming).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants