首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在mac上安装cocopods时有问题

在mac上安装cocopods时有问题
EN

Stack Overflow用户
提问于 2022-03-18 10:50:56
回答 1查看 364关注 0票数 1

当我尝试使用sudo在我的mac上安装cocoapods时,即“sudo宝石安装cocoapods”。

它显示无法构建创业板本机扩展。如何在mac上安装cocoapods,

代码语言:javascript
复制
xxx-MacMini1 ~ % sudo gem install cocoapods
Password:
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/usr/local/opt/ruby@2.7/bin/ruby -I /usr/local/Cellar/ruby@2.7/2.7.5/lib/ruby/2.7.0 -r ./siteconf20220318-18160-1id5gxj.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make DESTDIR\= clean

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make DESTDIR\=
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
compiling ClosurePool.c
compiling DynamicLibrary.c
compiling Function.c
Function.c:867: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:867:17: note: did you mean 'ffi_prep_closure'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:269:1: note: 'ffi_prep_closure' declared here
ffi_prep_closure(
^
1 error generated.
make: *** [Function.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/ffi-1.15.5/gem_make.out

我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2022-03-20 22:54:22

看来你有红宝石问题了。尝试使用以下方法安装2.6.3版本:

代码语言:javascript
复制
sudo gem install cocoapods -v 2.6.3

然后尝试运行sudo gem install cocoapods。如果此操作不起作用,请尝试以下操作:

开放终端并运行

代码语言:javascript
复制
curl -L https://get.rvm.io | bash -s stable

然后

代码语言:javascript
复制
rvm install ruby-2.6

这将为您安装红宝石,如果它还没有安装。在此之后,只需将ruby更新为新版本

代码语言:javascript
复制
rvm use ruby-2.6.3

将ruby 2.6.3作为默认设置

代码语言:javascript
复制
rvm --default use 2.6.3

希望你能跑

代码语言:javascript
复制
sudo gem install cocoapods
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71525926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档