包Update上FFI失败(Bundle update fails on ffi)

2019-06-24 10:12发布

我试图做一个bundle update我的Rails应用程序,但我得到以下错误:

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>'

有任何想法吗?

Answer 1:

我碰到类似这样昨天的一个问题。

我能够使用这些步骤来解决它:

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

从本质上讲,有一个与我的包和清除的东西出来,并从头开始重建的事情解决了这一个问题。

在此重复的步骤:

# 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

虽然,由于在输出文本消息:

你必须先安装开发工具。

这让我觉得你刚才可能没有安装苹果的Xcode开发工具 。 你检查了吗? (我相信他们是在Mac App Store中提供。)



Answer 2:

对于Xcode的5及更高版本:

$ xcode-select --install

安装命令行工具。



Answer 3:

一旦从BREW安装GCC-4.2,你需要创建它的符号链接:

ln -s /usr/bin/gcc /usr/bin/gcc-4.2


Answer 4:

以防万一,尝试运行

须藤的/ usr / bin中/ GCC

你可能会看到许可协议,所以滚动thgough它,键入“同意”,并尝试重新安装宝石。



Answer 5:

请注意:

如果您最近更新的Xcode中,您可能只需要打开Xcode和接受的最新协议

我有同样的问题,最近安装的更新到Xcode的(V6.1),并通过以下步骤来解决它:

  1. 开放的Xcode
  2. 接受新协议
  3. 重新运行包更新


Answer 6:

安装“命令行工具”通过Xcode中没有的伎俩。

如果你的Xcode 4.5开放首选项 > 下载 >选择组件选项卡,然后点击旁边的命令行工具 安装

虽然我在Xcode安装,也可以从下载安装包,没有它苹果的开发者下载和搜索“命令行工具” 。



Answer 7:

对我来说,我只是没有安装GCC,在Ubuntu解决方式:

sudo apt install build-essential


Answer 8:

我不得不接受的Xcode用户许可:

运行sudo的xcrun CC应该弹出的Xcode许可协议的CLI版本。 另一种方法是打开Xcode.app并在GUI同意。

可能通过更新OSX引起的。

http://blog.tomhennigan.co.uk/post/62238548037/agreeing-to-the-xcode-license-from-the-command



Answer 9:

MAC OSX 10.10.2约塞米蒂

 CC=/usr/bin/i686-apple-darwin11-llvm-gcc-4.2 gem install ffi

和多数民众赞成它-确认你有4.2编译器/usr/bin ,你可以挂接到

ls /usr/bin|grep gcc|grep 4.2

你不必消灭所有本地宝石或覆盖符号链接做到这一点 -它浪费时间,很可能会带来更多的问题,然后解决了。

请注意,您的bin路径可能会有所不同,如果你需要通过BREW安装

brew install apple-gcc42 


Answer 10:

另外的方法:

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
bundle update

ffi.h是在被发现${SDKROOT}/usr/include/ffi/ffi.h



Answer 11:

Ubuntu的LTS忠实的14.04

需要从红宝石2.2.1切换到2.3.0支持Rails应用新的gem版本。

解:

  1. rvm get stable
  2. rvm remove 2.3.0
  3. rvm install 2.3.0
  4. bundle install


文章来源: Bundle update fails on ffi