Reese Knowledgebase

Failed to build gem native extension

View Kristian Reese's profile on LinkedIn

If you like this article, please +1 or Recommend via FB with the provided buttons above:

Article ID: 167
by: Reese K.
Posted: 14 Oct, 2015
Last updated: 14 Oct, 2015
Views: 784

reese@myMacBook ~ $ gem install showoff
Building native extensions.  This could take a while...
ERROR:  Error installing showoff:
    ERROR: Failed to build gem native extension.

    /Users/reese/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20151014-6287-1urbfy1.rb extconf.rb
*** 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:
/Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.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/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
    from /Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
    from /Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:642:in `block in try_ldflags'
    from /Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:635:in `with_ldflags'
    from /Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:641:in `try_ldflags'
    from /Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:1762:in `pkg_config'
    from extconf.rb:64:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/reese/.rvm/gems/ruby-2.1.5/gems/eventmachine-1.0.8 for inspection.
Results logged to /Users/reese/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-14/2.1.0-static/eventmachine-1.0.8/gem_make.out

I had to look at the mkmf.og to see what the heck was going on.  Turns out I had not yet accepted the xcode license!  WTF!  Running sudo xcodebuild -license allowed me to agree to the license from command line, then I was able to gem install showoff.

eesek@myMacBook ~ $ cat /Users/reese/.rvm/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/eventmachine-1.0.8/mkmf.log
"gcc -o conftest -I/Users/reese/.rvm/rubies/ruby-2.1.5/include/ruby-2.1.0/x86_64-darwin14.0 -I/Users/reese/.rvm/rubies/ruby-2.1.5/include/ruby-2.1.0/ruby/backward -I/Users/reese/.rvm/rubies/ruby-2.1.5/include/ruby-2.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/Users/mpapis/.sm/pkg/active/include -fPIC -mmacosx-version-min=10.7 -pipe conftest.c  -L. -L/Users/reese/.rvm/rubies/ruby-2.1.5/lib -L. -L/Users/mpapis/.sm/pkg/active/lib -fPIC -Bstatic -fstack-protector   -arch x86_64   -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc "

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
checked program was:
/* begin */
1: #include "ruby.h"
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

reese@myMacBook ~ $ sudo xcodebuild -license
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] agree

This article was:   Helpful | Not Helpful
Prev   Next