无法在Mac OS X 10.8.4上安装json 1.8 gem [英] Can't install json 1.8 gem on Mac OS X 10.8.4

查看:93
本文介绍了无法在Mac OS X 10.8.4上安装json 1.8 gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在第二台计算机上安装我的Rails应用程序。但是当我运行 bundle install 时,我得到一个json gem的错误:

  Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展。 

/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0。 0-p195 / bin / ruby​​:无效选项-D(-h将显示有效选项)(RuntimeError)


Gem文件将保持安装在/Users/feuerball/.rvm/gems /ruby-2.0.0-p195/gems/json-1.8.0进行检查。
记录到/Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
$ b的结果$ b安装json(1.8.0)时发生错误,并且Bundler无法继续。
确保在捆绑之前`gem install json -v'1.8.0'`成功。

计算机使用Xcode 4.6.3和最新的命令行工具运行Mac OS X 10.8.4。



我使用rvm安装了最新的ruby:
$ b

  $ rvm  - v 

rvm 1.21.2(稳定)由Wayne E. Seguin< wayneeseguin@gmail.com>,Michal Papis< mpapis@gmail.com> [https://rvm.io/]

$ ruby​​ -v
ruby​​ 2.0.0p195(2013-05-14 revision 40734)[x86_64-darwin12.4.0]
$ gem -v
2.0.3

当我尝试使用 gem install json 我得到几乎相同的错误:

 构建原生扩展。这可能需要一段时间... 
错误:安装json时出错:
错误:无法构建gem本机扩展。

/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0。 0-p195 / bin / ruby​​:无效选项-D(-h将显示有效选项)(RuntimeError)


Gem文件将保持安装在/Users/feuerball/.rvm/gems /ruby-2.0.0-p195/gems/json-1.8.0进行检查。
结果记录到/Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
code>

尝试使用 sudo 进行安装并不会改变任何内容。



我卸载并重新安装了自制软件,rvm,ruby&命令行工具,但没有什么帮助。



更新



Contentent of /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generato R / gem_make.out

  /Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb 
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby:无效选项-D(-h将显示有效选项)(RuntimeError)

GCC版本:

  $ gcc -v 
使用内置规格。
目标:i686-apple-darwin11
配置为:/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix = /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir = / share / man --enable-languages = c,objc,c ++,obj-c ++ --program-prefix = llvm- - -program-transform-name = / ^ [cg] [^ .-] * $ / s / $ / - 4.2 / --with-slibdir = / usr / lib --build = i686-apple-darwin11 --enable- llvm = / private / var / tmp / llvmgcc42 / llvmgcc42-2336.11〜182 / dst-llvmCore / Developer / usr / local --program-prefix = i686-apple-darwin11- --host = x86_64-apple-darwin11 --target = i686-apple-darwin11 --with-gxx-include-dir = / usr / include / c ++ / 4.2.1
线程模型:posix
gcc版本4.2.1(基于Apple Inc. build更新2

>

我做了全新安装的OS X,Xcode,命令行工具,Homebrew,rvm和Ruby。 Ruby现在是修补程序级别247,该死的问题仍然存在。多么浪费时间......如果它很重要:rvm将json 1.7.7与ruby一起安装



Update 3



似乎我的机器在所有原生扩展上都失败。 gem install bcrypt-ruby 给出相同的错误信息。 问题在于我的主文件夹位于名称中包含空格的单独卷上。由于这个空间,名字的第二部分被解释为一个选项。卷名称类似于 My Data ,因此我得到了消息无效选项-D



我刚刚重新命名了这个卷,现在一切都安装正常。


I'm trying to to install my rails app on a second computer. But when I run bundle install I get an error with the json gem:

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

    /Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb 
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D  (-h will show valid options) (RuntimeError)


Gem files will remain installed in /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0 for inspection.
Results logged to /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/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.

The computer runs Mac OS X 10.8.4 with Xcode 4.6.3 and the latest command line tools.

I installed the latest ruby using rvm:

$ rvm -v

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

$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
$ gem -v
2.0.3

When I try to install the json gem using gem install json I get almost the same error:

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

    /Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D  (-h will show valid options) (RuntimeError)


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

Trying to install using sudo does not change anything.

I uninstalled and reinstalled homebrew, rvm, ruby & the command line tools but nothing helps.

Update

Contentent of /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generato‌​r/gem_make.out:

/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
/Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D  (-h will show valid options) (RuntimeError)

GCC Version:

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

Update 2

I did a fresh install of OS X, Xcode, Command Line Tools, Homebrew, rvm and Ruby. Ruby is now patch level 247 and the damn problem is still there. What a waste of time... If it is important: rvm installed json 1.7.7 together with ruby

Update 3

Seems that my machine fails on all native extensions. gem install bcrypt-ruby gives the same error message.

解决方案

The problem was that my home folder is on a separate volume which contained a space in its name. Because of the space the second part of the name was interpreted as an option. The volumes name was something like My Data and thus I got the messageinvalid option -D.

I just renamed this volume and now everything installs fine.

这篇关于无法在Mac OS X 10.8.4上安装json 1.8 gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆