30 Nov 2012, 07:04
Generic-user-small

William Bentley (2 posts)

After installing GLI and running the gli scaffold command gli scaffold to-do new list done

I try to run bin/todo new as per page 26, and I am given the message ~~~ In development, you need to use bundle exec bin/todo to run your app At install-time, RubyGems will make sure lib, etc. are in the load path Feel free to remove this message from bin/todo now ~~~

Ok, I try it with bundle exec bin/todo and I get:

Could not find gem 'aruba (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

I run bundle install and I get:

Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.2) 
Installing ffi (1.2.0) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/william/.rvm/rubies/ruby-1.9.2-p320/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
	--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/william/.rvm/rubies/ruby-1.9.2-p320/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/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
	from /Users/william/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
	from extconf.rb:14:in `<main>'


Gem files will remain installed in /Users/william/.rvm/gems/ruby-1.9.2-p320/gems/ffi-1.2.0 for inspection.
Results logged to /Users/william/.rvm/gems/ruby-1.9.2-p320/gems/ffi-1.2.0/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.2.0), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.2.0'` succeeds before bundling.

Running gem install ffi -v '1.2.0' fails with the same errors.

============

Any pointers on how to resolve this issue?

I must say I seem to be spending more time resolving gem issues than in actually learning from your examples… pretty frustrating so far…

Thanks in advance for any help you can offer.

08 Dec 2012, 00:28
Dmfcb_pragsmall

David Copeland (98 posts)

Apologies for missing the instruction on running @bundle install@ - it was a total oversight, but that is the correct thing to do.

As to why this isn’t working, welcome to the wonderful world of Mountain Lion and Ruby 1.9.

If you do a google search, you’ll find some good stack overflow answers for the error you are getting, but, basically, what you need to do (and, unfortunately, this was not required at the time I published the book):

Install XCode via Mac App Store

# Go into XCode’s prefs, go to Downloads, and install command line tools # go to @/usr/local/bin/@ and symlink @llvm-gcc-4.2@ to @gcc-4.2@ (note, I can’t recall if it’s @/usr/local/bin@ or @/usr/bin@, but if it’s not in one location, it’ll be in the other) # try it again

Basically, the compile C extensions (aruba uses FFI, which is a C extension), you have to use the gcc 4.2 compiler, which is not the default @gcc@ on the system. Further, RubyGems seems to insist on using /usr/local/bin/gcc-4.2, even if you override it with an environment variable. UGH.

Hopefully this will get you going. I just had to go through this this week and the stack overflow posts were helpful, but it took a while tracking down.

05 Nov 2013, 04:41
Generic-user-small

William Bentley (2 posts)

Came back to this again. This time I tried just installing gcc49 using Homebrew. bundle install worked correctly, as well as bundle exec bin/todo.

For me, much better than messing with symlinks in /usr/bin, but that’s just me. :)

Thanks.

05 Nov 2013, 15:55
Dmfcb_pragsmall

David Copeland (98 posts)

Cool, and my apologies for formatting the instructions as a giant H1…I don’t know how that happened!

  You must be logged in to comment