Den*_*vic 45 ruby ruby-on-rails
无法安装特定的 ffi 版本。如果我运行 gem install 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
Run Code Online (Sandbox Code Playgroud)
/Users/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-darwin-19/2.6.0/ffi-1.9.18/gem_make.out
安装 ffi (1.9.18) 时出错,Bundler 无法继续。gem install ffi -v '1.9.18'在捆绑之前确保成功。
在 Gemfile 中:bootstrap-sass 被解析为 3.3.7,依赖 sass 被解析为 3.5.5,依赖 sass-listen 被解析为 4.0.0,依赖 rb-inotify 被解析为 0.9.10,这取决于 ffi
小智 147
要克服该错误,请使用以下命令安装 ffi:
gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"
nar*_*789 13
对于那些可以的人,我认为这里应该首选碰撞 ffi 版本。bundle update ffi带我从1.9.18到1.13.1并为我成功构建。
@denis-osmerovic,除非您有另一个依赖项阻止 ffi,否则您也应该能够撞到 ffi。检查我的依赖链,我的 ffi 依赖也来自rb-inotify 0.9.10,和你的一样。列出的要求是为了ffi (>= 0.5.0, < 2),所以1.13.1应该是可以接受的。
我以前有一个 ffi 的工作副本1.19.18,我不记得需要传递任何特殊的构建标志。为了重现这一点,我卸载并尝试重新安装该版本。我猜在此期间其他库或工具链更新破坏了这一点。
我在 OS X 10.15.7 和 Xcode 12.0.1 上运行 ruby 2.6.3
小智 8
如果你想要捆绑安装 ffi 1.9.8
bundle config --local build.ffi --with-cflags=-Wno-error=implicit-function-declaration
bundle install
Run Code Online (Sandbox Code Playgroud)
在 M1 Catalina 11.6 上,我首先通过执行以下操作来解决该错误:
bundle update ffi
然后因为我不关心哪个版本:
gem install ffi -- --with-cflags="-Wno-error=implicit-function-declaration"
如果您需要一个版本,其他答案都有。
| 归档时间: |
|
| 查看次数: |
8205 次 |
| 最近记录: |