Ruby on rails Can';t安装ffi-v&x27;1.9.18';卡塔利纳马科斯酒店

Ruby on rails Can';t安装ffi-v&x27;1.9.18';卡塔利纳马科斯酒店,ruby-on-rails,ruby,Ruby On Rails,Ruby,无法安装特定的ffi版本。如果我运行gem安装ffi,一切正常,但我需要特定的版本1.9.18,它不工作 Fetching ffi 1.9.18 Installing ffi 1.9.18 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/

无法安装特定的ffi版本。如果我运行gem安装ffi,一切正常,但我需要特定的版本1.9.18,它不工作

Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi- 
1.9.18/ext/ffi_c
/Users/chille/.rbenv/versions/2.6.5/bin/ruby -I 
/Users/chille/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r
./siteconf20200928-22154-72wopi.rb extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
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
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile

current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi- 
1.9.18/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi- 
1.9.18/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:355:5: error: implicit declaration of function 'rb_thread_call_without_gvl' is 
invalid in C99
[-Werror,-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
                                  ^
1 error generated.
make: *** [Call.o] Error 1

make failed, exit code 2

Gem files will remain installed in 
/用户/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.9.18进行检查。 结果记录到/Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64- 达尔文-19/2.6.0/ffi-1.9.18/gem_make.out

安装ffi(1.9.18)时出错,捆绑程序无法继续。 捆绑之前,请确保
gem安装ffi-v'1.9.18'
成功

在文件中: 引导sass已解析为3.3.7,这取决于 sass解析为3.5.5,这取决于 sass listen已解析为4.0.0,这取决于 rb inotify解析为0.9.10,这取决于
ffi

由于ffigem的本质,它与YARV发动机的内部紧密结合。因此,您需要确保您使用的YARV版本与
ffi
gem的版本相匹配


2017年,这将是Ruby 2.4。请注意,自2020年4月起,Ruby 2.4不再受支持。

要克服该错误,请使用以下方法安装ffi:


gem install ffi-v'1.9.18'--with cflags=“-Wno error=implicit function declaration”

对于那些能够安装ffi的人,我认为这里应该首选bumping ffi版本<代码>捆绑更新ffi将我从
1.9.18
带到
1.13.1
并为我成功构建

@denis osmerovic,除非你有另一个依赖阻止了外国金融机构,否则你也应该能够阻止外国金融机构。检查我的依赖项链,我的ffi依赖项也来自
rb inotify
0.9.10
,与您的相同。所列要求适用于
ffi(>=0.5.0,<2)
,因此
1.13.1
应该是可以接受的

其他背景: 我以前有一个ffi
1.19.18
的工作副本,我不记得需要传递任何特殊的构建标志。为了重现这一点,我卸载并尝试重新安装该版本。我猜在此期间,其他库或工具链更新破坏了这一点


如果您想捆绑安装ffi 1.9.8,我将在OS X 10.15.7上运行ruby 2.6.3和Xcode 12.0.1

bundle config --local build.ffi --with-cflags=-Wno-error=implicit-function-declaration

bundle install

根据ruby gems.org,这个版本已经有3.5年的历史了。它似乎不是针对ruby的更高版本构建的(我使用ruby 2.7重新创建了您的错误)。您使用的是什么版本的rails?@rmlockerd rails 5.1.7和Ruby 2.6.5我所要做的就是
gem卸载ffi
所有版本
,然后通过
捆绑安装重新安装。对我有效的版本是
1.11.1
尝试了所有其他选项,这一个非常有效,谢谢!这太棒了!效验如神我在noi4r上也遇到了同样的问题,这也解决了这个问题
gem安装ffi-v'1.14.2'--with cflags=“-Wno error=implicit function declaration”
。我为这个问题争论了很长时间。Rails 6.1,ruby 3.0.0。这个答案被低估了,谢谢。我在一个旧的存储库上工作,在mac Big Slur开发机器上多次尝试配置ffi后,简单地升级到1.13.1就是解决方案。当ffi是其他gem的依赖项时,此解决方案效果更好。