3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gem ffi 1.14.2 エラーの解決方法 そのn番目

Last updated at Posted at 2021-03-06

この記事について

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ライブラリが上手く使うためのオプションなのかな?

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?