关于mac安装rails报错clang: error: unknown argument

文章都是从我的个人博客上转载过来的,大家可以点击我的个人博客.

www.iwangzheng.com

 

mac上安装rails的时候报错,

安装rails的在终端执行了一句命令:

$sudo gem install rails

报错了,报错信息为

clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]

 

完整的执行过程及报错信息如下:

 

angela@angeladeMacBook-Air:~$sudo gem install rails

Password:

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

ERROR:  Error installing rails:

ERROR: Failed to build gem native extension.

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

creating Makefile

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

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/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

 

原因很简单,

Xcode 5.1中的苹果编译器将不认识的命令行视为错误行为。这类报错常出现在ruby和python的安装过程中,因为这两类程序中,很多编译语句较为特殊。

 

解决方案就是在安装语句前面加上这句

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

 

以安装rails为例,使用以下的语句:

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

转载于:https://www.cnblogs.com/iwangzheng/p/3722906.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值