我的Mac版本是10.15.7,我正在尝试安装cocoapod,但是出现以下错误

时间:2020-10-28 10:16:53

标签: macos cocoapods

错误:无法构建gem本机扩展。

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0- / ./siteconf20201028-1045-ukvwvo.rb extconf.rb 检查ffi.h ... *** extconf.rb失败*** 由于某些原因(可能缺少必要)而无法创建Makefile 库和/或标题。检查mkmf.log文件以获取更多详细信息。你可以 需要配置选项。

提供的配置选项: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include = $ {opt-dir} / include --with-opt-lib --without-opt-lib = $ {opt-dir} / lib --with-make-prog --with-make-prog --srcdir =。 --curdir --ruby = /系统/库/框架/Ruby.framework/版本/2.6/usr/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include = $ {ffi_c-dir} / include --with-ffi_c-lib --without-ffi_c-lib = $ {ffi_c-dir} / lib --enable-system-libffi --disable-system-libffi --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:在try_compile的try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in 块中 来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:在with_werror' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in try_compile'中 来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in block in have_header' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in 中的check_for' 来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in open' 来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in open' 来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:在postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in 中 来自/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:在have_header' from extconf.rb:10:in system_libffi_usable中?” 来自extconf.rb:42:in''

要查看此扩展为何无法编译,请检查mkmf.log,该文件可在此处找到:

/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.13.1/mkmf.log

extconf失败,退出代码1

宝石文件将保留安装在/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1中以进行检查。 结果记录到/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.13.1/gem_make.out

1 个答案:

答案 0 :(得分:0)

尝试在终端中执行以下命令,

sudo apt-get install ruby-dev

sudo apt-get install ruby1.9.1-dev

仍然无法正常工作吗?安装ruby-dev后,尝试以下操作:

sudo apt-get install make