この記事について
bundle install
実行時にffi 1.14.2
のところでこけてしまう。
環境
- Mac Catalina
- ruby 2.6.3
- rails 6.0.3
エラー内容
Fetching ffi 1.14.2
Installing ffi 1.14.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/ketchamash/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/ffi-1.14.2/ext/ffi_c
/Users/ketchamash/.rbenv/versions/2.6.3/bin/ruby -I
/Users/ketchamash/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20210306-53720-1m14ww7.rb
extconf.rb
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
creating extconf.h
creating Makefile
current directory:
/Users/ketchamash/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/ffi-1.14.2/ext/ffi_c
make "DESTDIR=" clean
current directory:
/Users/ketchamash/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/ffi-1.14.2/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
compiling ClosurePool.c
compiling DynamicLibrary.c
compiling Function.c
Function.c:847:17: error: implicit declaration of function 'ffi_prep_closure_loc' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
ffiStatus = ffi_prep_closure_loc(closure->pcl, &fnInfo->ffi_cif, callback_invoke, closure,
code);
^
Function.c:847:17: note: did you mean 'ffi_prep_closure'?
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/ffi/ffi.h:269:1: note:
'ffi_prep_closure' declared here
ffi_prep_closure(
^
1 error generated.
make: *** [Function.o] Error 1
make failed, exit code 2
なんやかんや
An error occurred while installing ffi (1.14.2), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.14.2' --source 'https://rubygems.org/'` succeeds before
bundling.
In Gemfile:
spring-watcher-listen was resolved to 2.0.1, which depends on
listen was resolved to 3.4.1, which depends on
rb-inotify was resolved to 0.10.1, which depends on
ffi
解決のために試したこと
1.gem install ffi -v '1.14.2
を実行
2.Qiitaで参考にさせて頂いた記事
自分の場合、こちらでは解決できませんでした。
解決できた参考ページ
gemのインストール時に--disable-system-libffi
オプションをつけて実行するとインストールできた。
gem install ffi -- --disable-system-libffi
解決できた理由?
libffiライブラリが上手く使うためのオプションなのかな?