ruby - 无法安装pushmeup插件

标签 ruby cordova rubygems push-notification phonegap-plugins

我尝试安装用于phonegap推送通知的pushmeup插件(ios)。
当我运行命令 sudo gem install pushmeup 时,出现此错误:

Building native extensions. This could take a while... ERROR: Error installing pushmeup: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby

extconf.rb creating 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

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out

GitHub:

https://github.com/phonegap-build/PushPlugin

参数:

ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

gem -v 2.2.2

Mac OS X v 10.9.2

XCode Version 5.1 (5B130a)

cordova -v 3.4.0-0.1.3

最佳答案

显然苹果在 Mavericks 上犯了一些错误,他们删除了警告标志 unused-command-line-argument-hard-error-in-future根据此问题:#528

请尝试此命令:

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

它有什么作用?这设置了环境变量:ARCHFLAGS=这会添加忽略警告 -Wno-error=这是您在小牛中看不到的警告 unused-command-line-argument-hard-error-in-future (应该忽略)

Apple documentation :

Compiler

As of Apple LLVM compiler version 5.1 (clang-502) and later, the optimization level -O4 no longer implies link time optimization (LTO). In order to build with LTO explicitly use the -flto option in addition to the optimization level flag. (15633276) The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified. Projects using invalid compiler options will need to be changed to remove those options. To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:

-Wno-error=unused-command-line-argument-hard-error-in-future

Note: This option will not be supported in the future. To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning. For example, you can install a Python native extension with:

$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install ExtensionName

Similarly, you can install a Ruby Gem with:

$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName 16214764 updated

编辑历史

刚刚在我的机器上使用相同的 ruby​​ 进行了测试:

$ gem install pushmeup
Fetching: pushmeup-0.1.2.gem (100%)
Successfully installed pushmeup-0.1.2
Parsing documentation for pushmeup-0.1.2
Installing ri documentation for pushmeup-0.1.2
Done installing documentation for pushmeup after 1 seconds
1 gem installed

据我所知,您没有使用 rvmrbenv所以问题不在 gcc依赖项

根据提供的输出,错误发生在安装 json-1.8.1 时。 您可以发布位于:/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out的日志吗? ?

关于ruby - 无法安装pushmeup插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22666327/

相关文章:

ruby - 如何在 Windows 7 上安装 ruby​​ gem

ruby-on-rails - jekyll 主题不会更新,没有错误,页面呈现为 'minima'

当字符串本身以单词边界结尾时,Ruby 正则表达式匹配由单词边界字符包围的字符串

python - 合并/丢弃重叠的单词

cordova - 如何查看 Phonegap/Cordova 项目中安装的所有插件?

javascript - jQuery mobile - 可以只使用导航栏所需的代码吗?

javascript - PhoneGap/Cordova - 未收到 "camera permission"提示

ruby-on-rails - 从 Ruby on Rails 中以 sudo 方式读取文件

ruby - CSV 仅返回字符串。我需要保留值类型