Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle update fails on ffi

I'm attempting to do a bundle update on my rails application but I get the following error:

Installing ffi (1.0.11) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks! /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)          /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/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=/Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/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}/lib     --with-libffi-config     --without-libffi-config     --with-pkg-config     --without-pkg-config /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'     from extconf.rb:9:in `<main>'   Gem files will remain installed in /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11 for inspection. Results logged to /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/ffi-1.0.11/ext/ffi_c/gem_make.out     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:530:in `block in build_extensions'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `each'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `build_extensions'     from /Users/Kyle/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/source.rb:90:in `block in install'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb:82:in `preserve_paths'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/source.rb:89:in `install'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:73:in `block in install_gem_from_spec'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb:97:in `with_build_args'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:72:in `install_gem_from_spec'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:56:in `block in run'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:55:in `run'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:12:in `install'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/cli.rb:271:in `update'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/task.rb:22:in `run'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor.rb:263:in `dispatch'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/base.rb:386:in `start'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/bin/bundle:13:in `<top (required)>'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/bin/bundle:19:in `load'     from /Users/Kyle/.rvm/gems/ruby-1.9.3-p125/bin/bundle:19:in `<main>' 

Any ideas?

like image 518
Kyle Decot Avatar asked May 13 '12 22:05

Kyle Decot


People also ask

What is the difference between bundle install and bundle update?

The most common question I've heard about Bundler is about the difference between bundle install and bundle update . In a nutshell: bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler.

What is FFI gem?

Ruby-FFI is a gem for programmatically loading dynamically-linked native libraries, binding functions within them, and calling those functions from Ruby code. Moreover, a Ruby-FFI extension works without changes on CRuby (MRI), JRuby, Rubinius and TruffleRuby.

What does bundle update -- bundler do?

bundle update is a command provided by the Bundler gem which will update all your gem dependencies to their latest versions. Providing you have a Gemfile. lock pre-existing, running bundle install will only install the versions specified in the Gemfile.


1 Answers

I ran into a problem similar to this yesterday.

I was able to resolve it using these steps:

https://github.com/carlhuda/bundler/blob/1-0-stable/ISSUES.md

Essentially, there was a problem with my bundle and clearing things out and rebuilding things from scratch resolved it.

The steps are repeated here:

# remove user-specific gems and git repos rm -rf ~/.bundle/ ~/.gem/  # remove system-wide git repos and git checkouts rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/  # remove project-specific settings and git repos rm -rf .bundle/  # remove project-specific cached .gem files rm -rf vendor/cache/  # remove the saved resolve of the Gemfile rm -rf Gemfile.lock  # try to install one more time bundle install 

Although, given the message in the output text:

You have to install development tools first.

That makes me think you just may not have installed the Apple Xcode Developer Tools. Have you checked that? (I believe they're available in the Mac App Store.)

like image 127
Kevin Bedell Avatar answered Sep 23 '22 19:09

Kevin Bedell