我尝试安装用于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:
参数:
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
(应该忽略)
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
据我所知,您没有使用 rvm
或rbenv
所以问题不在 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/