Ruby Gem安装Json在Mavericks,Xcode 5.1上失败,提示“unknown argument: '-multiply_definedsuppress'”怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (31)

我运行gem安装json遇到错误:

Gem::Ext::BuildError: 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 /opt/boxen/repo/.bundle/ruby/2.0.0/gems/json-1.8.0 for inspection.
Results logged to /opt/boxen/repo/.bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.0/gem_make.out

我用的是:

OS X:10.9.2

Xcode:5.15B130a

命令行工具(CLT):5.1.0.0.1.1393561416

Ruby:Ruby2.0.0p247

Ruby Gem:2.2.2

GCC:4.2.1 Apple LLVM 5.1

提问于
用户回答回答于

我遇到了完全相同的问题。

先这样吧,使用代码安装json gem:

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

用户回答回答于

有现成的方案了:

curl https://gist.githubusercontent.com/Paulche/9713531/raw/1e57fbb440d36ca5607d1739cc6151f373b234b6/gistfile1.txt | sudo patch /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb

扫码关注云+社区