安装 cocoapods 时出错:无法构建 gem 本机扩展

Error installing cocoapods: Failed to build gem native extension

Building native extensions.  This could take a while...

错误:安装 cocoapods 时出错: 错误:无法构建 gem 本机扩展。

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150610-6663-7exisu.rb extconf.rb

正在创建 Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [generator.bundle] Error 1

make failed, exit code 2

这是终端错误日志,我找不到我更新的解决方案 ruby 和系统以及很多我错了的东西-我有 ios7 和 Mac-10.9

我想你在安装 cocoapods gem 之前已经 运行 gem update,所以你所有的 gem 都应该更新。

该消息是 XCode 5.1 引入的新警告,现在将未知参数威胁为错误。您没有指定您使用的是哪个版本的 cocoapods 和 XCode,但我的猜测是两者之间存在不匹配。也许 Xcode 太老了?您正在安装全新的 cocoapods,因此至少应该是最新的。

而不是更新 XCode,您可以尝试禁用该警告并希望编译成功完成,在安装 cocoapods 之前设置一个环境变量,这样:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install cocoapods

我按照以下步骤安装 Cocoapods。可能对你有用。

  1. 打开终端
  2. gem install cocoapods
  3. pod setup