【问题标题】:make fails during install of json-1.8.0 with unrecognized option '-arch' on OSX 10.8.4在 OSX 10.8.4 上使用无法识别的选项“-arch”安装 json-1.8.0 时 make 失败
【发布时间】:2013-08-14 20:18:04
【问题描述】:

我正在尝试正确设置我的 ruby​​ 环境,但在尝试 bundle install 我的测试应用程序时不断收到错误消息。

我在尝试bundle install 时首先遇到错误:

$ rails new app
// [...] 
run bundle install

Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0) 
Using i18n (0.6.5) 
Using multi_json (1.7.9) 
Using activesupport (3.2.9) 
Using builder (3.0.4) 
Using activemodel (3.2.9) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.3) 
Using tilt (1.4.1) 
Using sprockets (2.2.2) 
Using actionpack (3.2.9) 
Using mime-types (1.23) 
Using polyglot (0.3.3) 
Using treetop (1.4.14) 
Using mail (2.4.4) 
Using actionmailer (3.2.9) 
Using arel (3.0.2) 
Using tzinfo (0.3.37) 
Using activerecord (3.2.9) 
Using activeresource (3.2.9) 
Using bundler (1.3.5) 
Using coffee-script-source (1.6.3) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Installing json (1.8.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/ryan/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb 
creating Makefile

make
compiling generator.c
gcc-4.6: error: x86_64: No such file or directory
gcc-4.6: error: unrecognized option '-arch'
make: *** [generator.o] Error 1


Gem files will remain installed in /Users/ryan/.rvm/gems/ruby-1.9.3-p327/gems/json-1.8.0 for inspection.
Results logged to /Users/ryan/.rvm/gems/ruby-1.9.3-p327/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.

在错误消息的最后一行我尝试gem install json -v '1.8.0' 但得到以下信息:

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

        /Users/ryan/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
gcc-4.6: error: x86_64: No such file or directory
gcc-4.6: error: unrecognized option '-arch'
make: *** [generator.o] Error 1


Gem files will remain installed in /Users/ryan/.rvm/gems/ruby-1.9.3-p327/gems/json-1.8.0 for inspection.
Results logged to /Users/ryan/.rvm/gems/ruby-1.9.3-p327/gems/json-1.8.0/ext/json/ext/generator/gem_make.out

任何帮助将不胜感激...我目前使用以下版本的 rvm,ruby + rails:

$ ruby -v
ruby 1.9.3p327 (2012-11-10) [x86_64-darwin12.2.0]

$ rails -v
Rails 3.2.9

$ rvm -v
rvm 1.22.1 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

如果您需要任何其他信息,请告诉我。

【问题讨论】:

    标签: ruby macos gem rvm


    【解决方案1】:

    听起来这可能是二进制红宝石引起的,试试:

    rvm get head
    rvm reinstall 1.9.3-p327 --disable-binary
    

    【讨论】:

    • 我有同样的问题,但在不同的宝石上。这对于您看到 gcc-4.6 的任何错误都是正确的:错误:x86_64:没有这样的文件或目录 gcc-4.6:错误:无法识别的选项 '-arch'。
    • 我有gem,我该如何解决这个问题?
    【解决方案2】:

    删除 gemfile.lock 并运行 bundle

    【讨论】:

    • 我知道这个答案不能解释自己,但它确实对我有用!
    【解决方案3】:

    如果您安装了rvm,这应该可以工作:

    rvm reinstall 2.0.0-p247 --disable-binary
    

    如果您刚刚更新了 OS X,您可能想先尝试一些其他的东西。见thoughtbot's guide

    【讨论】:

      【解决方案4】:

      我遇到了这个问题,我决定将 Ruby 的默认版本更改为 1.9.3p327。

      离开项目文件夹并发出命令:

      rvm use 1.9.3-P327 --default
      

      我不知道这是为什么,因为rvm修改了项目中的版本,但是在执行'bundle install'时它没有出错

      【讨论】:

        【解决方案5】:

        我认为你应该为你的 rvm 设置正确的版本。例如,如果您在 ruby​​ 1.9.3 中开发了您的应用程序,您应该设置 “rvm 使用 1.9.3”。然后你可以输入“bundle install”命令。也许这会对你有所帮助。

        谢谢

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-08-27
          • 1970-01-01
          • 1970-01-01
          • 2013-07-25
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-02-17
          相关资源
          最近更新 更多