美文网首页
报错Failed to build gem native ext

报错Failed to build gem native ext

作者: 4VZhang | 来源:发表于2020-03-09 10:47 被阅读0次

    环境

    mac系统版本:macOS Mojave10.14.6
    ruby:ruby 2.3.7p456 (2018-03-28 revision 63024)
    cocoapods: 1.5.0

    issue

    拿到一个新项目(cocoapods 1.9.0),使用sudo gem install cocoapods更新仓库!报错如下:

    Building native extensions. This could take a while...
    ERROR:  Error installing cocoapods:
        ERROR: Failed to build gem native extension.
    
        current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200309-13044-14m1r7i.rb extconf.rb
    mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
    Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out
    

    尝试了gem update --systemxcode-select --installsudo apt-get install ruby-dev等方法未解决该问题!

    解决方法

    open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

    Done installing documentation for ffi, 
    ethon, typhoeus, netrc, cocoapods-core, claide,
     cocoapods-deintegrate, cocoapods-downloader, 
    cocoapods-plugins, cocoapods-search, 
    cocoapods-stats, cocoapods-trunk, cocoapods-try,
     molinillo, atomos, CFPropertyList, colored2,
     nanaimo, xcodeproj, escape, fourflusher, gh_inspector, 
    ruby-macho, cocoapods after 50 seconds
    24 gems installed
    

    参考链接

    相关文章

      网友评论

          本文标题:报错Failed to build gem native ext

          本文链接:https://www.haomeiwen.com/subject/crdudhtx.html