LoginSignup
1
1

More than 5 years have passed since last update.

RubyGemのThinインストールでエラー(Failed to build gem native extension.)

Posted at
[18:33:20] home $ gem install thin

Building native extensions.  This could take a while...
ERROR:  Error installing thin:
    ERROR: Failed to build gem native extension.

    current directory: /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/eventmachine-1.2.0.1/ext
/Users/home/.rbenv/versions/2.1.4/bin/ruby -r ./siteconf20160417-22765-zb71nv.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:
    --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/home/.rbenv/versions/2.1.4/bin/ruby
    --with-ssl-dir
    --without-ssl-dir
    --with-ssl-include
    --without-ssl-include=${ssl-dir}/include
    --with-ssl-lib
    --without-ssl-lib=${ssl-dir}/lib
    --with-openssl-config
    --without-openssl-config
    --with-pkg-config
    --without-pkg-config
/Users/home/.rbenv/versions/2.1.4/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/home/.rbenv/versions/2.1.4/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
    from /Users/home/.rbenv/versions/2.1.4/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
    from /Users/home/.rbenv/versions/2.1.4/lib/ruby/2.1.0/mkmf.rb:642:in `block in try_ldflags'
    from /Users/home/.rbenv/versions/2.1.4/lib/ruby/2.1.0/mkmf.rb:635:in `with_ldflags'
    from /Users/home/.rbenv/versions/2.1.4/lib/ruby/2.1.0/mkmf.rb:641:in `try_ldflags'
    from /Users/home/.rbenv/versions/2.1.4/lib/ruby/2.1.0/mkmf.rb:1762:in `pkg_config'
    from extconf.rb:65:in `pkg_config_wrapper'
    from extconf.rb:92:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/eventmachine-1.2.0.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/eventmachine-1.2.0.1 for inspection.
Results logged to /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/eventmachine-1.2.0.1/gem_make.out

thinをインストールしようとしたらこんなエラーが出た。

/Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/eventmachine-1.2.0.1/mkmf.log

これを見ろと言われたのでエディタで開けてみる。

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Xcodeのlicenseがどうのこうのと言われているが、よくわからない。最後にsudoでやってって言われているから本当はちゃんと理由を調べてからやらなくちゃいけないのだろうけど、sudoでgem installしてみる。

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.

そうするとエラーが変わった。またXcodeのlicenseについて言われているからぐぐってみたら解決に繋がりそうな記事を見つけた。

Agreeing to the Xcode/iOS license... のエラーがでた時の対処法

そういえば最近Xcodeをインストールしたんだった。これで再度実行した所またエラーが。

Permission denied @ rb_sysopen - /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/eventmachine-1.2.0.1/CHANGELOG.md

これはパーミッションが問題みたいだからsudoをつけて実行。インストールできました。
安易にsudoを使わないようにしているけど、まだまだ実力が足りないな〜…。

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1