Home > front end >  Can't install `ffi -v 1.12.2` on mac OS Monterey
Can't install `ffi -v 1.12.2` on mac OS Monterey

Time:07-20

I'm installing it as a dependency of selenium-webdriver

This is my error

```
Installing ffi 1.12.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/vbolz001/.rbenv/versions/2.2.10/bin/ruby -r ./siteconf20220719-28031-2p2yz6.rb extconf.rb
checking for ffi_call() in -lffi... no
checking for ffi_call() in -llibffi... no
checking for shlwapi.h... no
checking for rb_thread_call_without_gvl()... no
Ruby C-API function `rb_thread_call_without_gvl` is missing
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/Users/vbolz001/.rbenv/versions/2.2.10/bin/$(RUBY_BASE_NAME)
        --with-ffi_c-dir
        --without-ffi_c-dir
        --with-ffi_c-include
        --without-ffi_c-include=${ffi_c-dir}/include
        --with-ffi_c-lib
        --without-ffi_c-lib=${ffi_c-dir}/lib
        --enable-system-libffi
        --disable-system-libffi
        --with-libffi-config
        --without-libffi-config
        --with-pkg-config
        --without-pkg-config
        --with-ffilib
        --without-ffilib
        --with-libffilib
        --without-libffilib
extconf failed, exit code 1
Gem files will remain installed in /Users/vbolz001/.rbenv/versions/2.2.10/lib/ruby/gems/2.2.0/gems/ffi-1.12.2 for inspection.
Results logged to /Users/vbolz001/.rbenv/versions/2.2.10/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-18/2.2.0-static/ffi-1.12.2/gem_make.out

An error occurred while installing ffi (1.12.2), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.12.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  selenium-webdriver was resolved to 3.141.0, which depends on
    childprocess was resolved to 0.9.0, which depends on
      ffi

I've already uninstalled and reinstalled my CommandLineTools.

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

CodePudding user response:

I have the same issue on M1 with ffi 1.15.5 and it works if I do:

gem install ffi -v '1.15.5' -- --with-cflags=-Wno-implicit-function-declaration

Same thing goes for ffi 1.12.2.

As far as I understand it (don't know C and googled this) - When C doesn’t find a function, it assumes it is implicitly declared and errors out. --with-cflags=-Wno-implicit-function-declaration tells the compiler to ignore any functions that are implicitly declared.

  • Related