Error: Error Installing Ffi: Error: Failed to Build Gem Native Extension

Can't Install ffi -v '1.9.18' on macos Catalina

To get past that error, install ffi using:

gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"

Error installing ffi. Faild to build native Extention

There is this line in the error message:

You have to install development tools first.

Please ensure that you have XCode and the Xcode Command Line Toolsinstalled. Please open XCode at least once to accept the licence agreement.

Installing ffi 1.12.2 with native extensions FAILED

The relevant error in your log is:

/bin/sh: /Applications/Xcode: No such file or directory

This is caused by:

clang: error: no input files 
cd "/Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c/libffi-x86_64-darwin18" && /Applications/Xcode 10_3.app/Contents/Developer/usr/bin/make

The makefile for ffi probably doesn't support spaces in the command-line tool's path. You should rename your Xcode name and make sure xcode-select -p points to the updated path without spaces.

This answer might not be relevant to you anymore, but it took me quite some time to notice this in the log. I'm posting so that anyone with the same issue stumbling on this question can find an answer!

Can't install `ffi -v 1.12.2` on mac OS Monterey

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 Topics



Leave a reply



Submit