当我尝试使用sudo在我的mac上安装cocoapods时,即“sudo宝石安装cocoapods”。
它显示无法构建创业板本机扩展。如何在mac上安装cocoapods,
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
我该如何解决这个问题?
发布于 2022-03-20 22:54:22
看来你有红宝石问题了。尝试使用以下方法安装2.6.3版本:
sudo gem install cocoapods -v 2.6.3然后尝试运行sudo gem install cocoapods。如果此操作不起作用,请尝试以下操作:
开放终端并运行
curl -L https://get.rvm.io | bash -s stable然后
rvm install ruby-2.6这将为您安装红宝石,如果它还没有安装。在此之后,只需将ruby更新为新版本
rvm use ruby-2.6.3将ruby 2.6.3作为默认设置
rvm --default use 2.6.3希望你能跑
sudo gem install cocoapodshttps://stackoverflow.com/questions/71525926
复制相似问题