1

So I'm doing [this super basic Rails tutorial][1], and I'm stuck at this part:

bundle install --without production

It runs through a list of dependencies (?) but seems to get stuck on something calling ffi 1.9.10, where it gives me the following error message:

Using concurrent-ruby 1.0.0
Installing ffi 1.9.10 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/stephensmith/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20160101-33768-1kfzc9h.rb 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
    .
    .
    .
    --without-pkg-config
/Users/stephensmith/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/stephensmith/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
    .
    .
    .
    from /Users/stephensmith/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
    from extconf.rb:16:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/stephensmith/.rvm/gems/ruby-2.2.3@real_estate/gems/ffi-1.9.10 for inspection.
Results logged to /Users/stephensmith/.rvm/gems/ruby-2.2.3@real_estate/extensions/x86_64-darwin-14/2.2.0-static/ffi-1.9.10/gem_make.out
Using formatador 0.2.5
.
.
.
Using sprockets 3.5.2
An error occurred while installing ffi (1.9.10), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.10'` succeeds before bundling.

Any idea what's going on and how to fix it? I'm sure it's something simple, but I can't figure it out to continue with the tutorial. :-(

Stephen Smith
  • 367
  • 1
  • 4
  • 12
  • did you try ```xcode-select --install```? and are you on Mavericks or Yosemite or even a mac for that matter? – MilesStanfield Jan 01 '16 at 20:42
  • Possible duplicate of [An error occured while installing ffi (1.1.2), and Bundler cannot continue](http://stackoverflow.com/questions/11725577/an-error-occured-while-installing-ffi-1-1-2-and-bundler-cannot-continue) – MilesStanfield Jan 01 '16 at 20:50
  • I'm on El Capitan...just did what you suggested, @MilesStanfield, and it seemed to install something, but then when I tried `bundle install --without production`, it gave me the same error. – Stephen Smith Jan 01 '16 at 20:50
  • When I try to do `sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2` as recommended there, I get the following error: `ln: /usr/bin/gcc-4.2: Operation not permitted` – Stephen Smith Jan 01 '16 at 20:54
  • @Stephen Smith: This doesn't address your question, but when I started learning rails I wish somebody told me about using Cloud 9 IDE for Rails development. I encountered the same issue, and unless your really need to use your machine, you can bypass all sorts of installation issues by working there in an environment designed specifically for Rails. – gbutters Jan 01 '16 at 22:47

1 Answers1

1

Given that your home directory is /Users/<username> I am guessing you are on a Mac. You need to install the Xcode command line tools as explained in this article

You can do this from the command line using xcode-select

lorefnon
  • 12,875
  • 6
  • 61
  • 93
  • All up to date, but I'm getting the same error message :-( – Stephen Smith Jan 01 '16 at 20:55
  • I get this – which is what I'm supposed to get, right? `/Applications/Xcode.app/Contents/Developer` – Stephen Smith Jan 01 '16 at 20:57
  • Yes. Can you check if the following file exists: `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ffi/ffi.h` ? You may need to change 10.9 to your version of os. – lorefnon Jan 01 '16 at 21:02
  • The solutions in this thread may also be helpful : http://stackoverflow.com/questions/10575679/bundle-update-fails-on-ffi – lorefnon Jan 01 '16 at 21:03
  • There is a `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ffi/ffi.h`, yes. – Stephen Smith Jan 01 '16 at 21:06
  • So when I try to follow the instruction there, I do all of the `rm`s, but then I still get this error: `An error occurred while installing json (1.8.3), and Bundler cannot continue.` (And it goes on for a while, but you get the idea. – Stephen Smith Jan 01 '16 at 21:16