macOS10.15、xcode12 安装cocoapods失败

问题描述:


ERROR: Error installing cocoapods:

ERROR: Failed to build gem native extension

Function.c:847:17: error: implicit declaration of function 'ffi_prep_closure_loc' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ffiStatus = ffi_prep_closure_loc(closure->pcl, &fnInfo->ffi_cif, callback_invoke, closure, code); ^Function.c:847:17: note: did you mean 'ffi_prep_closure'?

。。。

/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/ffi/ffi.h:269:1: note: 'ffi_prep_closure' declared hereffi_prep_closure(^1 error generated.make: *** [Function.o] Error 1make failed, exit code 2

捣鼓了一天时间,ruby rvm brew 都重装升级了个遍 还是不行;仔细查看报错原因,是因为 ffi_prep_closure_loc 这个隐式声明的方法在CommandLineTools/SDKs/MacOSX10.14.sdk中没有找到导致的。于是,查看了/Library/Developer/CommandLineTools/SDKs/目录下得文件:

bogon:SDKs xxx$ ls -a

. .. MacOSX.sdk MacOSX10.14.sdk MacOSX10.15.sdk MacOSX11.1.sdk

目录下一共有三个版本的sdk文件:MacOSX10.14.sdk MacOSX10.15.sdk MacOSX11.1.sdk

不清楚为什么ruby会引用MacOSX10.14.sdk中的文件,本人电脑系统是10.15的,于是,删除了MacOSX10.14.sdk这个文件,重新安装cocoapods

sudo gem install -n /usr/local/bin cocoapods

Installing ri documentation for cocoapods-1.10.1

Done installing documentation for ffi, ethon, typhoeus, public_suffix, fuzzy_match, concurrent-ruby, httpclient, algoliasearch, addressable, thread_safe, tzinfo, i18n, activesupport, cocoapods-core, cocoapods after 21 seconds

15 gems installed

bogon:~ jieyang$ pod --version

1.10.1

终于安装成功了!!!

你可能感兴趣的:(macOS10.15、xcode12 安装cocoapods失败)