在 OS X 上安装 vagrant-libvirt 插件时出错

Fra*_*cca 5 macos libvirt vagrant vagrant-libvirt

我在运行时遇到以下错误vagrant plugin install vagrant-libvirt

\n

设置

\n
    \n
  1. 安装自制程序

    \n
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n
    Run Code Online (Sandbox Code Playgroud)\n
  2. \n
  3. 在自制软件中安装

    \n
    brew install --cask vagrant && \\\nbrew install make gcc qemu libiconv libvirt\n
    Run Code Online (Sandbox Code Playgroud)\n
  4. \n
  5. 仔细检查 libvirt 路径

    \n
  6. \n
\n
\xe2\x9e\x9c  ~ brew --prefix libvirt\n/opt/homebrew/opt/libvirt\n
Run Code Online (Sandbox Code Playgroud)\n

更新路径

\n
HOMEBREW_HOME="/opt/homebrew/opt"\nLIBICONV_HOME="$HOMEBREW_HOME/libiconv"\n\nexport PATH="$LIBICONV_HOME/bin:$PATH"\nexport PATH="$HOMEBREW_HOME/make/libexec/gnubin:$PATH"\nexport LDFLAGS="-L$LIBICONV_HOME/lib"\nexport CPPFLAGS="-I$LIBICONV_HOME/include"\nexport CONFIGURE_ARGS="with-libvirt-lib=$(brew --prefix libvirt)/lib with-libvirt-include=$(brew --prefix libvirt)/include"\n
Run Code Online (Sandbox Code Playgroud)\n

错误

\n
\xe2\x9e\x9c  ~ vagrant plugin install vagrant-libvirt\n\nInstalling the \'vagrant-libvirt\' plugin. This can take a few minutes...\nFetching formatador-1.1.0.gem\nFetching fog-core-2.3.0.gem\nFetching fog-json-1.2.0.gem\nFetching nokogiri-1.13.9-x86_64-darwin.gem\nFetching fog-xml-0.1.4.gem\nFetching ruby-libvirt-0.8.0.gem\nBuilding native extensions. This could take a while...\nVagrant failed to properly resolve required dependencies. These\nerrors can commonly be caused by misconfigured plugin installations\nor transient network issues. The reported error is:\n\nERROR: Failed to build gem native extension.\n\n    current directory: /Users/yakforward/.vagrant.d/gems/2.7.6/gems/ruby-libvirt-0.8.0/ext/libvirt\n/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.7.0 -r ./siteconf20221111-11883-1v7zec5.rb extconf.rb\nLooking for libvirt in /opt/homebrew/opt/libvirt/include and /opt/homebrew/opt/libvirt/lib\nchecking for virConnectOpen() in -lvirt... no\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of necessary\nlibraries and/or headers.  Check the mkmf.log file for more details.  You may\nneed configuration options.\n\nProvided configuration options:\n    --with-opt-dir\n    --with-opt-include\n    --without-opt-include=${opt-dir}/include\n    --with-opt-lib\n    --without-opt-lib=${opt-dir}/lib\n    --with-make-prog\n    --without-make-prog\n    --srcdir=.\n    --curdir\n    --ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)\n    --with-libvirt-include\n    --with-libvirt-lib\n    --with-virt-dir\n    --without-virt-dir\n    --with-virt-include\n    --without-virt-include=${virt-dir}/include\n    --with-virt-lib\n    --without-virt-lib=${virt-dir}/lib\n    --with-virtlib\n    --without-virtlib\nextconf.rb:44:in `<main>\': No working libvirt installation found (RuntimeError)\n\nTo see why this extension failed to compile, please check the mkmf.log which can be found here:\n\n  /Users/yakforward/.vagrant.d/gems/2.7.6/extensions/x86_64-darwin-19/2.7.0/ruby-libvirt-0.8.0/mkmf.log\n\nextconf failed, exit code 1\n\nGem files will remain installed in /Users/yakforward/.vagrant.d/gems/2.7.6/gems/ruby-libvirt-0.8.0 for inspection.\nResults 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\n
Run Code Online (Sandbox Code Playgroud)\n\n\n 信息\n
\xe2\x9e\x9c  ~ neofetch\n                    \'c.          yakforward@yakforward.local\n                 ,xNMM.          ---------------------------\n               .OMMMMo           OS: macOS 13.0.1 22A400 arm64\n               OMMM0,            Host: MacBookAir10,1\n     .;loddo:\' loolloddol;.      Kernel: 22.1.0\n   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 53 mins\n .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 89 (brew)\n XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8.1\n;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1440x900\n:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua\n.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor\n kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark)\n .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: iTerm2\n  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: Monaco 12\n    kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Apple M1\n     ;KMMMMMMMWXXWMMMMMMMk.      GPU: Apple M1\n       .cooc,.    .,coo:.        Memory: 1129MiB / 8192MiB\n\n
Run Code Online (Sandbox Code Playgroud)\n
\xe2\x9e\x9c  ~  vagrant --version\nVagrant 2.3.2\n
Run Code Online (Sandbox Code Playgroud)\n\n

日志

\n

mkmf.log \n gem_make.out.zip

\n

小智 0

步骤1:

brew install qemu gcc libvirt.

第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
Run Code Online (Sandbox Code Playgroud)

如果这对您不起作用,请尝试将本教程本教程结合起来。