ERROR: Failed to build gem native extension

2019-07-13 04:30发布

问题:

gem install unf_ext -v '0.0.6'
localhost:workflow_boyun ryan007$ gem install unf_ext -v '0.0.6'
Building native extensions.  This could take a while...
ERROR:  Error installing unf_ext:
    ERROR: Failed to build gem native extension.

        /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for main() in -lstdc++... *** 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/ryan007/.rvm/rubies/ruby-1.9.3-p392/bin/ruby
    --with-stdc++lib
    --without-stdc++lib
/Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/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/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:845:in `block in have_library'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/ryan007/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:840:in `have_library'
    from extconf.rb:2:in `<main>'


Gem files will remain installed in /Users/ryan007/.rvm/gems/ruby-1.9.3-p392@rails3.2.8/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/ryan007/.rvm/gems/ruby-1.9.3-p392@rails3.2.8/gems/unf_ext-0.0.6/ext/unf_ext/gem_make.out

回答1:

I update my mac os to 10.9 last Sunday,but I forgot command line tools. when I check my xcode,I do not find "command line tools".In the end, some one told me "Run xcode-select --install".Then I fellow him,and it works.I installed "command line tools", everything goes well.hope my answer can help u



标签: gem