【问题标题】:Rails – Bundle install problems with jsonRails – 使用 json 捆绑安装问题
【发布时间】:2013-11-13 18:41:52
【问题描述】:

我正在使用 Rails 3.2.12 运行 OS X Mavericks。当我尝试做 rails new project 时,它卡在 bundle install 中。

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb 
creating Makefile

make
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1


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

当我按照它的建议执行“gem install json....”时,我得到了同样的错误。我已经使用命令行工具安装了最新版本的 Xcode。当我这样做时:

which gcc

我明白了:

/usr/bin/gcc

我对所有这些东西真的很陌生,所以请尽量保持简单。

【问题讨论】:

    标签: ruby-on-rails json gcc gem osx-mavericks


    【解决方案1】:

    所以,在 XCode 5 之前,有一个 gcc-4.2 二进制文件,在升级中被删除了。

    我发现这个tutorial 有助于恢复 gcc-4.2 并使用 ruby​​ 运行。它假定您使用 homebrew 来管理 Mac 上的软件包。

    【讨论】:

    • 您分享的第一个链接,对我帮助很大。谢谢。
    • 嗨,我在 windows 上的 rails 4 上遇到了与 json 相关的完全相同的错误。我没有听说过这个 xcode。它与MACO有关吗?我无法决定在 Windows 上安装它是否也能解决我的问题??
    猜你喜欢
    • 2012-02-20
    • 1970-01-01
    • 2012-09-11
    • 1970-01-01
    • 1970-01-01
    • 2011-08-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多