升级cocopods提示ffi错误

问题描述

cocoapod升级到1.12.0
sudo gem install -n /usr/local/bin cocoapods

报错

chehaodeMBP:~ chehao$ sudo gem install -n /usr/local/bin 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/3.2.0/gems/ffi-1.15.5/ext/ffi_c
/usr/local/opt/ruby/bin/ruby extconf.rb
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/3.2.0/gems/ffi-1.15.5/ext/ffi_c
make DESTDIR\= sitearchdir\=./.gem.20230406-38908-8oiid9 sitelibdir\=./.gem.20230406-38908-8oiid9 clean

current directory: /usr/local/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/ext/ffi_c
make DESTDIR\= sitearchdir\=./.gem.20230406-38908-8oiid9 sitelibdir\=./.gem.20230406-38908-8oiid9
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/MacOSX10.14.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/3.2.0/gems/ffi-1.15.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-22/3.2.0/ffi-1.15.5/gem_make.out

解决方案:

sudo gem inst ffi – --disable-system-libffi

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值