可可豆荚的 Xcode 12.3 问题
Posted
技术标签:
【中文标题】可可豆荚的 Xcode 12.3 问题【英文标题】:Xcode 12.3 issue with Cocoa Pods 【发布时间】:2021-01-26 14:22:11 【问题描述】:如果您在使用 Xcode 12.3 时尝试安装 Cocoa pod,您可能会收到以下错误:
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
package configuration for libffi is not found
"xcrun clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.Internal.sdk/usr/local/lib -arch x86_64 -lruby.2.6 "
In file included from conftest.c:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks')
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4:
5: return 0;
6:
/* end */
【问题讨论】:
【参考方案1】:要解决此问题,您需要:
确保你有Command Line Tools for Xcode 12.3 要在您的 MacOS 上安装 Cocoa Pod,请使用以下命令: sudo gem install -n /usr/local/bin cocoapods -v 1.8.4
最新的 CocoaPods 1.10.0 将无法工作。
要更新到最新版本,您需要使用brew commands
然后输入下面的命令:
brew install cocoapods
【讨论】:
我不明白为什么 CocoaPods 1.10.0 不应该与 Xcode 12.3 一起使用?我也不同意用 brew 安装 Cocoapods。 Cocoapods 是一个 gem,可以完美地安装。 这里也一样,但不幸的是这就是发生的事情,你可以在很多在线文章和苹果开发者网站上看到这个问题:(以上是关于可可豆荚的 Xcode 12.3 问题的主要内容,如果未能解决你的问题,请参考以下文章