Gem install ffi 无法构建 gem 本机扩展 [英] Gem install ffi Failed to build gem native extension

查看:223
本文介绍了Gem install ffi 无法构建 gem 本机扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Rails 4.2.10 中开始工作的一个项目中无法进行捆绑安装.当我捆绑时,我收到下一个错误:

I'm having troubles to do bundle install in one project I get to work on in Rails 4.2.10. When I bundle I receive the next error:

安装 ffi (1.9.25) 时出错,Bundler 无法继续.打包前确保 gem install ffi -v '1.9.25' 成功.

An error occurred while installing ffi (1.9.25), and Bundler cannot continue. Make sure that gem install ffi -v '1.9.25' succeeds before bundling.

In Gemfile:
  s3_direct_upload was resolved to 0.1.6, which depends on
    sass-rails was resolved to 5.0.7, which depends on
      sass was resolved to 3.6.0, which depends on
        sass-listen was resolved to 4.0.0, which depends on
          rb-inotify was resolved to 0.9.10, which depends on
            ffi

当我运行 gem install ffi -v '1.9.25' 时也会出现错误:

When I run gem install ffi -v '1.9.25' also an error occurs:

Building native extensions. This could take a while...
ERROR:  Error installing ffi:
    ERROR: Failed to build gem native extension.

    current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
/xxx/xxx/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20190110-6923-1jimorr.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_closure_alloc()... no
checking for ffi_raw_call()... no
checking for shlwapi.h... no
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR=" clean

current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18" && /Volumes/Macintosh HD/Applications/Xcode.app/Contents/Developer/usr/bin/make
/bin/sh: /Volumes/Macintosh: No such file or directory
make: *** ["/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25 for inspection.
Results logged to /xxx/xxx/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-18/2.5.0/ffi-1.9.25/gem_make.out

我在网上尝试了很多解决方案,但都无法解决这个问题.似乎问题出在我的系统上,因为我是团队的新手,其他开发人员无法帮助我,因为他们没有这种问题.

I've been trying many solutions online but cannot resolve this issue. Seems the issue is with my system as I'm new to the team and the other developers were unable to help me as they do not have this kind of issue.

推荐答案

我能够使用以下命令成功安装 ffi:

I was able to successfully install ffi with the following command:

LDFLAGS="-L/usr/local/opt/libffi/lib" PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" gem install ffi -v '1.9.25'

在一些日本棋盘上找到

这篇关于Gem install ffi 无法构建 gem 本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆