【问题标题】:Installing ffi 1.12.2 with native extensions FAILED使用本机扩展安装 ffi 1.12.2 失败
【发布时间】:2020-02-27 11:13:53
【问题描述】:

运行“gem install ffi”并尝试在 MacOS 上安装后,出现以下错误:

> $ gem install ffi 
> NOTE:Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/escape-0.0.4.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/fuzzy_match-2.0.4.gemspec:17.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/i18n-0.9.5.gemspec:17. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/little-plugger-1.1.4.gemspec:18.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/logging-2.2.2.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/open4-1.3.4.gemspec:16. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/escape-0.0.4.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/fuzzy_match-2.0.4.gemspec:17.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/i18n-0.9.5.gemspec:17. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/little-plugger-1.1.4.gemspec:18.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/logging-2.2.2.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/open4-1.3.4.gemspec:16. Building
> native extensions. This could take a while... ERROR:  Error installing
> ffi:  ERROR: Failed to build gem native extension.
> 
>     current directory: /Users/georgegoci/.gem/gems/ffi-1.12.2/ext/ffi_c
> /Users/myuser/.rbenv/versions/2.7.0/bin/ruby -I
> /Users/myuser/.rbenv/versions/2.7.0/lib/ruby/2.7.0 -r
> ./siteconf20200227-34272-rl7ya0.rb extconf.rb checking for ffi.h... no
> checking for ffi.h in /usr/local/include,/usr/include/ffi... no
> checking for shlwapi.h... no checking for
> rb_thread_call_without_gvl()... yes checking for
> ruby_native_thread_p()... yes checking for ruby_thread_has_gvl_p()...
> yes creating extconf.h creating Makefile
> 
> current directory: /Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c
> make "DESTDIR=" clean
> 
> current directory: /Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c
> make "DESTDIR=" Configuring libffi clang: error: unsupported option
> '-print-multi-os-directory' clang: error: no input files cd
> "/Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c/libffi-x86_64-darwin18"
> && /Applications/Xcode 10_3.app/Contents/Developer/usr/bin/make
> /bin/sh: /Applications/Xcode: No such file or directory make: ***
> ["/Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a]
> Error 127
> 
> make failed, exit code 2
> 
> Gem files will remain installed in
> /Users/myuser/.gem/gems/ffi-1.12.2 for inspection. Results logged
> to
> /Users/myuser/.gem/extensions/x86_64-darwin-18/2.7.0/ffi-1.12.2/gem_make.out

我也尝试过这个解决方案:

  1. Gem install ffi Failed to build gem native extension
  2. Installing pg 1.1.3 with native extensions fails

但仍然没有解决方案。

有什么想法吗?

【问题讨论】:

  • 您使用的是哪个命令行工具版本?你可以在 Xcode > Preferences > Locations 上看到它

标签: macos rubygems bundle ffi failed-installation


【解决方案1】:

您日志中的相关错误是:

/bin/sh: /Applications/Xcode: No such file or directory

这是由于:

clang: error: no input files 
cd "/Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c/libffi-x86_64-darwin18" && /Applications/Xcode 10_3.app/Contents/Developer/usr/bin/make

ffi 的生成文件可能不支持命令行工具路径中的空格。您应该重命名您的 Xcode 名称,并确保 xcode-select -p 指向没有空格的更新路径。

此答案可能与您不再相关,但我花了很长时间才在日志中注意到这一点。我发帖是为了让遇到同样问题的人都能找到答案!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-30
    • 2011-05-25
    • 1970-01-01
    • 1970-01-01
    • 2011-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多