Search code examples
macosrubygemsbundleffifailed-installation

Installing ffi 1.12.2 with native extensions FAILED


After running "gem install ffi" and trying to install it on MacOS, am getting the following error:

> $ gem install ffi 
> NOTE:Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/escape-0.0.4.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/fuzzy_match-2.0.4.gemspec:17.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/i18n-0.9.5.gemspec:17. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/little-plugger-1.1.4.gemspec:18.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/logging-2.2.2.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/open4-1.3.4.gemspec:16. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/escape-0.0.4.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/fuzzy_match-2.0.4.gemspec:17.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/i18n-0.9.5.gemspec:17. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/little-plugger-1.1.4.gemspec:18.
> NOTE: Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/logging-2.2.2.gemspec:18. NOTE:
> Gem::Specification#rubyforge_project= is deprecated with no
> replacement. It will be removed on or after 2019-12-01.
> Gem::Specification#rubyforge_project= called from
> /Users/myuser/.gem/specifications/open4-1.3.4.gemspec:16. Building
> native extensions. This could take a while... ERROR:  Error installing
> ffi:  ERROR: Failed to build gem native extension.
> 
>     current directory: /Users/georgegoci/.gem/gems/ffi-1.12.2/ext/ffi_c
> /Users/myuser/.rbenv/versions/2.7.0/bin/ruby -I
> /Users/myuser/.rbenv/versions/2.7.0/lib/ruby/2.7.0 -r
> ./siteconf20200227-34272-rl7ya0.rb extconf.rb checking for ffi.h... no
> checking for ffi.h in /usr/local/include,/usr/include/ffi... no
> checking for shlwapi.h... no checking for
> rb_thread_call_without_gvl()... yes checking for
> ruby_native_thread_p()... yes checking for ruby_thread_has_gvl_p()...
> yes creating extconf.h creating Makefile
> 
> current directory: /Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c
> make "DESTDIR=" clean
> 
> current directory: /Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c
> make "DESTDIR=" Configuring libffi clang: error: unsupported option
> '-print-multi-os-directory' 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
> /bin/sh: /Applications/Xcode: No such file or directory make: ***
> ["/Users/myuser/.gem/gems/ffi-1.12.2/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a]
> Error 127
> 
> make failed, exit code 2
> 
> Gem files will remain installed in
> /Users/myuser/.gem/gems/ffi-1.12.2 for inspection. Results logged
> to
> /Users/myuser/.gem/extensions/x86_64-darwin-18/2.7.0/ffi-1.12.2/gem_make.out

I have trying this solutions as well:

  1. Gem install ffi Failed to build gem native extension
  2. Installing pg 1.1.3 with native extensions fails

But still no solution.

Any ideas?


Solution

  • 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!