Edited at

vagrantのpluginインストールでffiでコケる

More than 5 years have passed since last update.


状況

Vagrnatのpluginを入れようとしたら、ffiでコケるようになってしまった。

特にVagrant環境変えてないのに。。。


試したこと


  • cask install vagrant --force

  • rm -rf ~/.vagrant.d/

どっちもダメで、インストール実証確認がされているvagrant-awsとかでもコケる。

ちくしょう、無駄にboxes消した。。


結果

XcodeをBeta使ったりGM入れたりで、xcode-selectを変更していたのが問題でした。

というよりは、xcode-selectはXcode-Beta.appを指定しているのに、Xcode-Beta.appを消したことが問題。

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

で修正。

無事pluginはインストールできるようになりました。


参考

https://groups.google.com/d/msg/vagrant-up/4b1GpI53JeA/J0UWTBrSdywJ

この辺りのコメントで思い出した。


log

以下エラーログ全文。

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 ffi (1.9.6), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.6'` succeeds before bundling.

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

/Applications/Vagrant/embedded/bin/ruby extconf.rb
checking for ffi.h... *** 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=/Applications/Vagrant/embedded/bin/ruby
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/Applications/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 /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /Applications/Vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:16:in `<main>'

Gem files will remain installed in /Users/fainder/.vagrant.d/gems/gems/ffi-1.9.6 for inspection.
Results logged to /Users/fainder/.vagrant.d/gems/gems/ffi-1.9.6/ext/ffi_c/gem_make.out