关于ffi安装失败的解决办法

gem install ffi发现没有permission,加上sudo后,报以下错误

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

    current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171009-18228-1rvmw97.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=/usr/bin/$(RUBY_BASE_NAME)2.3
    --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
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
    from /usr/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
    from /usr/lib/ruby/2.3.0/mkmf.rb:657:in `try_ldflags'
    from /usr/lib/ruby/2.3.0/mkmf.rb:1813:in `pkg_config'
    from extconf.rb:15:in `
' To see why this extension failed to compile, please check the mkmf.log which can be found here: /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.18 for inspection.

google一通还是没解决。。。
最后老老实实定位问题,log里面叫我查看mkmf.log,打开一看,gcc编译出错,尴尬,更新了gcc版本后问题解决,之后大家碰到这类问题,还是自己查看mkmf.log定位问题吧

你可能感兴趣的:(Android开发)