美文网首页
记一次pod init错误

记一次pod init错误

作者: 花飞雨勿 | 来源:发表于2022-06-09 11:14 被阅读0次

错误显示

➜  Demo pod init
Ignoring digest-crc-0.6.1 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.1
Ignoring unf_ext-0.0.7.7 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.7

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/usr/local/bin/pod init


### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

CocoaPods : 1.8.4
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.5.2 (20G95)
       Xcode : 13.2.1 (13C100)
         Git : git version 2.32.0 (Apple Git-132)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : aliyun - git - https://github.com/aliyun/aliyun-specs.git @ 4e69147e4a54bed3d6d30f7eafd8ba665f01a1c1
               edu-git-cocoapods-specs - git - https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git @ 89c0c5f238964fdcee296a7a8ac5de887c2a9ae3
               master - git - https://github.com/CocoaPods/Specs.git @ 5530ce56adc49abafd128afff58ffc62d3157c9f
               trunk - CDN - https://cdn.cocoapods.org/
               webmproject - git - https://github.com/webmproject/libwebp.git @ f9b30586eb2ad4b1466d4b58fb6720a096697752
               ZSpecs - git - https://github.com/ZhouChengLong/ZSpecs.git @ e4e0d515c096b933a9e6b4cc1d790d277fac333a

### Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0


### Error

RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.14.0/lib/xcodeproj/project.rb:227:in `initialize_from_file'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.14.0/lib/xcodeproj/project.rb:112:in `open'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/init.rb:41:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:333:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'


――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version.&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...
 - RuntimeError - [Xcodeproj] Unknown object version.
   https://github.com/CocoaPods/CocoaPods/issues/10746 [closed] [2 comments]
   5 weeks ago

 - RuntimeError - [Xcodeproj] Unknown object version.
   https://github.com/CocoaPods/CocoaPods/issues/7458 [closed] [23 comments]
   6 weeks ago

 - RuntimeError - [Xcodeproj] Unknown object version.
   https://github.com/CocoaPods/CocoaPods/issues/11125 [closed] [3 comments]
   23 Mar 2022

and 75 more at:
https://github.com/cocoapods/cocoapods/search?q=%5BXcodeproj%5D%20Unknown%20object%20version.&type=Issues&utf8=✓

解决方案:

Xcode13和cocoapods的版本不适配,需要升级cocoapods

1.卸载旧的
sudo gem uninstall cocoapods
2.安装新的
sudo gem install cocoapods
或者 sudo gem install -n /usr/local/bin cocoapods

升级过程出现问题

➜  ~ sudo gem install cocoapods
Ignoring digest-crc-0.6.1 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.1
Ignoring unf_ext-0.0.7.7 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.7
Fetching molinillo-0.8.0.gem
Fetching cocoapods-downloader-1.6.3.gem
Fetching nanaimo-0.3.0.gem
Fetching typhoeus-1.4.0.gem
Fetching ffi-1.15.5.gem
Fetching ethon-0.15.0.gem
Fetching addressable-2.8.0.gem
Fetching cocoapods-core-1.11.3.gem
Fetching rexml-3.2.5.gem
Fetching xcodeproj-1.21.0.gem
Fetching cocoapods-1.11.3.gem
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.6.0/gems/ffi-1.15.5/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220608-72459-1yxgeec.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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
    --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
    --enable-system-libffi
    --disable-system-libffi
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
    from extconf.rb:9:in `system_libffi_usable?'
    from extconf.rb:42:in `<main>'

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

  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/ffi-1.15.5/gem_make.out

升级错误

ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

解决问题:
这是ruby版版低导致的问题,升级ruby

\curl -sSL https://get.rvm.io | bash -s stable --ruby

可能会报错

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决问题:配置Hosts文件,多执行几次

185.199.111.133 raw.githubusercontent.com
20.205.243.166 github.com
59.24.3.173 gist.github.com
185.199.108.153 assets-cdn.github.com
185.199.108.133 gist.githubusercontent.com
185.199.110.133 cloud.githubusercontent.com
185.199.110.133 camo.githubusercontent.com
185.199.110.133 avatars0.githubusercontent.com
185.199.111.133 avatars1.githubusercontent.com
185.199.109.133 avatars2.githubusercontent.com
185.199.111.133 avatars3.githubusercontent.com
185.199.109.133 avatars4.githubusercontent.com
185.199.111.133 avatars5.githubusercontent.com
185.199.110.133 avatars6.githubusercontent.com
185.199.108.133 avatars7.githubusercontent.com
185.199.110.133 avatars8.githubusercontent.com
185.199.110.133 user-images.githubusercontent.com

中间还有可能升级 homebrew

brew upgrade

出现443问题,同样多执行几次就行。

相关文章

  • 记一次pod init错误

    错误显示 解决方案: Xcode13和cocoapods的版本不适配,需要升级cocoapods 升级过程出现问题...

  • pod init失败

    用xcode9.3新建的项目 pod init居然报错 pod init 之后 出现以下输出 我搜索有半天 错误应...

  • Pod init/install遇到的问题记录

    在终端执行pod init/install,出现错误: RuntimeError -[Xcodeproj]Unkn...

  • pod init 报错

    今天创建项目在终端输入pod init 后报错,错误如下 ――― MARKDOWN TEMPLATE ――――――...

  • 记一次:pod init失败

    失败报错: 原因分析:Xcode 升级后,版本跟cocoapods版本不匹配; 解决办法:1、升级cocoapod...

  • 解决CocoaPods报错:Gem::GemNotFoundEx

    一、错误描述 执行pod init、pod install失败,报错信息见下图: 二、解决步骤 1、失败的尝试 2...

  • pod init 出现cocoapods [!] Oh no,

    使用Xcode 14 开发时,如果执行pod init 命令,出现错误cocoapods [!] Oh no, a...

  • Pod常用命令

    pod命令汇总 #创建默认的Podfile$ pod init #第一次使用安装框架$ pod install #...

  • pod 命令 大全

    pod 命令 创建默认的 Podfile $ pod init 第一次使用安装框架 $ pod install 安...

  • Pod 常用命令

    pod 命令 创建默认的 Podfile $ pod init 第一次使用安装框架 $ pod install 安...

网友评论

      本文标题:记一次pod init错误

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