devopsgroup-io / vagrant-hostmanager

:pencil: A Vagrant plugin that manages hosts files within a multi-machine environment.
Mozilla Public License 2.0
1.46k stars 146 forks source link

An error occurred while installing ffi (1.9.14), and Bundler cannot continue. #214

Closed orsenthil closed 8 years ago

orsenthil commented 8 years ago

On Latest Ruby 2.3.1

When I try to install vagrant-hostmanager. I am running into this problem

$ vagrant plugin install vagrant-hostmanager
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
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.14), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.14'` succeeds before bundling.

Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /opt/vagrant/embedded/bin/ruby -r ./siteconf20160922-39823-jnzb5r.rb 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=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)
    --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}/lib
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
/opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:524:in `with_werror'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:321:in `open'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:321:in `open'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
    from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
    from extconf.rb:16:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/senthil/.vagrant.d/gems/gems/ffi-1.9.14 for inspection.
Results logged to /Users/senthil/.vagrant.d/gems/extensions/x86_64-darwin-12/2.2.0/ffi-1.9.14/gem_make.out
marduv88 commented 8 years ago

Watching... same problem here. Wish I could help.

clawconduce commented 8 years ago

I had the same error but for an s3 plugin. The log (/Users/charleslaw/.vagrant.d/gems/gems/ffi-1.9.10/ext/ffi_c/mkmf.log) said it could not find ffi.h, so I used brew to uninstall and re-install (and re-link) it. Then everything worked (I didn't set any env variables or anything. This may be useful:

[charleslaw@~/src/everything] (feature/vagrant-packer) $ brew remove libffi
Uninstalling /usr/local/Cellar/libffi/3.0.13... (14 files, 356.2K)
[charleslaw@~/src/everything] (feature/vagrant-packer) $ brew install libffi
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.0.13.mavericks.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/libffi-3.0.13.mavericks.bottle.tar.gz
==> Pouring libffi-3.0.13.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Some formulae require a newer version of libffi.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libffi/lib

==> Summary
🍺  /usr/local/Cellar/libffi/3.0.13: 14 files, 356.3K
[charleslaw@~/src/everything] (feature/vagrant-packer) $ brew link libffi
Warning: libffi is keg-only and must be linked with --force
Note that doing so can interfere with building software.
[charleslaw@~/src/everything] (feature/vagrant-packer) $ brew link libffi --force
Linking /usr/local/Cellar/libffi/3.0.13... 9 symlinks created

and FYI

ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]