ffi: "Could not create Makefile due to some reason"
I keep getting this error when I try to install ffi. I’ve googled it a bit, but haven’t been able to come up with anything that would make it install. Please advice.
Error:
➜ Vendor git:(master) ✗ sudo gem install ffi
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for ffi.h... *** 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
--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/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
--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
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:16:in `<main>'
Gem files will remain installed in /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/gems/1.9.1/gems/ffi-1.9.0 for inspection.
Results logged to /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 7
- Comments: 27 (1 by maintainers)
got the same issue. impossible for me to solve this issue. but using brew worked for me
brew install cocoapods
You probably need to install the xcode command line tools - http://railsapps.github.io/xcode-command-line-tools.html
If you already have the command line tools installed, resetting it to the default path can help:
You’re using brew as your package manager?
If so, see if this fixes it:
On Linux, try installing the development support files for zlib, e.g.
I faced this issue after upgrading to MacOS Mojave. All you need is to install Xcode again:
For me. I had to re-install Xcode command line tools and then use brew to install Cocoapods. Idk which one worked but nothing else was working.
Ubuntu 22.04 LTS
sudo apt install -y ruby ruby-dev ruby-colorize sudo apt-get install -y libncurses5-dev libtinfo-dev sudo apt-get install libz-dev sudo apt-get install build-essential dh-autoreconf sudo gem install colorls
colorls -A
still error on ubuntu 16
I basically get the same error:
Why do you think the ruby install is screwed up? Everything else is working.
What happens if you just try to do
It sounds like you’ve got your ruby install a bit screwed up now - I would uninstall that version from rvm and re-install it first.
@holgersindbaek You’ll need to check the actual errors in /Users/holgersindbaek/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
Have you installed other C based exts, like nokogiri?