【问题标题】:Installing ffi 1.9.21 with native extensions on Ruby 2.4.2, Ubuntu 17.10 failing在 Ruby 2.4.2 上安装带有本机扩展的 ffi 1.9.21,Ubuntu 17.10 失败
【发布时间】:2018-02-09 05:11:31
【问题描述】:

ffi gem 1.9.21 安装成功。 我也尝试运行这些命令,但没有成功。

sudo apt install libffi-dev
gem inst ffi

当我部署到 AWS 时出现此错误。错误看起来像这样。

Installing dotenv 2.2.1
Installing request_store 1.3.2
Installing draper 3.0.1

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/opt/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20180207-2245-1bjhja4.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_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

  make "DESTDIR=" clean

make "DESTDIR="
Running autoreconf for libffi
/var/app/ondeck/vendor/bundle/gems/ffi-1.9.21/ext/ffi_c/libffi/autogen.sh: line 2: exec: autoreconf: not found
make: *** ["/var/app/ondeck/vendor/bundle/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /var/app/ondeck/vendor/bundle/gems/ffi-1.9.21 for inspection.
Results logged to /var/app/ondeck/vendor/bundle/extensions/x86_64-linux/2.2.0-static/ffi-1.9.21/gem_make.out
An error occurred while installing ffi (1.9.21), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.21'` succeeds before bundling. (Executor::NonZeroExitStatus)

任何帮助将不胜感激。提前致谢。

【问题讨论】:

  • ffi gem 新版本 1.9.22 可用。更新到 ffi-1.9.22 解决了这个问题。

标签: ruby-on-rails rubygems ffi


【解决方案1】:

似乎这个问题是由于ffi最新版本,我在Gemfile中指定了ffi最旧版本gem 'ffi', '1.9.18'在控制台运行bundle install,它解决了我的问题。

【讨论】:

  • @AjayBarot - 您是否认为这是一个错误的答案?例如,要修复阻塞部署问题,修复版本可能不是一件坏事。
  • @AjayBarot - 从您的简短评论中并不清楚。我假设了最坏的情况。根据该页面中的信息,您是否有可以发布为答案的正确解决方案?
  • @Phil:我明白你的意思。在此之前,我认为问题出在 AWS 服务器上的包上。因此,由于对服务器的 gem 依赖错误,OP 会出现这种错误。在解决 gem 依赖之前,我更喜欢了解第一个链接中提到的 gem 'version' 之间的区别。但我认为这不是根本原因。
  • 谢谢。我为此奋斗了 2 个多小时。
【解决方案2】:

a comment on a relevant issue 中所述,解决方法是:

sudo apt install libffi-dev

【讨论】:

    【解决方案3】:

    在您的服务器中执行此操作

    sudo apt-get install ruby-dev
    

    参考:Registered issue

    如果这不起作用,请告诉我。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-07
    • 2011-12-28
    • 2019-04-01
    • 1970-01-01
    • 2022-11-14
    • 2018-09-14
    • 2018-09-16
    • 1970-01-01
    相关资源
    最近更新 更多