Home>

During the initial setup of Rspec, I did a git clone, cut the branch, moved to the specified remote branch, added'rspec-rails','~>3.6.0' to the gem, and bundle installed, but I got an error. It has become. Is the version of ffi different according to the error message? I tried to install it with gem install ffi -v '1.9.18', but that didn't work either ...

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/shirakawahayata/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR =" clean
current directory:
/Users/shirakawahayata/.rbenv/versions/2.6.6/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
/Users/shirakawahayata/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.9.18 for inspection.
Results logged to
/Users/shirakawahayata/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/ffi-1.9.18/gem_make.out
An error occurred while installing ffi (1.9.18), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.18' --source' https://rubygems.org/'`successs before bundling.
In Gemfile:
  bootstrap-sass was resolved to 3.4.1, which depends on
    sassc was resolved to 2.4.0, which depends on
      ffi
Gemfile contents
source'https://rubygems.org'
git_source (: github) do | repo_name |
  repo_name = "# {repo_name}/# {repo_name}" unless repo_name.include? ("/")
  "https://github.com/#{repo_name}.git"
end
gem'rails','~>5.1.1'
gem'sqlite3'
gem'puma','~>3.7'
gem'sass-rails','~>5.0'
gem'uglifier','>= 1.3.0'
gem'coffee-rails','~>4.2'
gem'turbolinks','~>5'
gem'jbuilder','~>2.5'
gem'ffi', '1.9.18'
group: development,: test do
  gem'byebug', platforms: [: mri,: mingw,: x64_mingw]
  gem'capybara','~>2.13.0'
  gem'selenium-webdriver'
  gem'rspec-rails','~>3.6.0'
end
group: development do
  gem'web-console','>= 3.3.0'
  gem'listen','>= 3.0.5','<3.2'
  gem'spring'
  gem'spring-watcher-listen','~>2.0.0'
  gem'faker', require: false # for sample data in development
end
gem'tzinfo-data', platforms: [: mingw,: mswin,: x64_mingw,: jruby]
gem'bootstrap-sass'
gem'jquery-rails'
gem'devise'
gem'paperclip'
gem'geocoder'
Contents of Gemfile.lock (excerpt only for ffi)
rb-inotify (0.9.8)
      ffi (>= 0.5.0)
What I tried

・ I tried bundle update, but there was no particular change.
-I specified it explicitly with gem install ffi -v '1.9.18' based on the error message, but I could not install it.

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.

  • Answer # 1

    After updating the software and installing the Xcode command line tools, I was successful!
    I thought I had put it in once, but it seems that it was uninstalled at some point. Sweat

  • Answer # 2

    Gem files will remain installed in /Users/shirakawahayata/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ffi-1.9.18 for inspection. Results logged to /Users/shirakawahayata/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/ffi-1.9.18/gem_make.out
    As you can see, gem_make.out remains, so read it.
    There are usually hints on what to do towards the very end