Json gem安装失败。 Xcode已经安装并且是最新的

时间:2015-03-31 18:29:00

标签: ruby-on-rails ruby json xcode rubygems

尝试运行捆绑程序时出现以下错误。

bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Using rake 10.0.4
Using i18n 0.6.1
Using multi_json 1.7.3
Using activesupport 3.2.13
Using builder 3.0.4
Using activemodel 3.2.13
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.2
Using tilt 1.4.1
Using sprockets 2.2.2
Using actionpack 3.2.13
Using mime-types 1.23
Using polyglot 0.3.3
Using treetop 1.4.12
Using mail 2.5.4
Using actionmailer 3.2.13
Using arel 3.0.2
Using tzinfo 0.3.37
Using activerecord 3.2.13
Using activeresource 3.2.13
Using coffee-script-source 1.6.2
Using execjs 1.4.0
Using coffee-script 2.2.0
Using rack-ssl 1.3.3

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/camerons/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150331-784-1yax4yj.rb extconf.rb 
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
/Users/camerons/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ (    \
        ^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' [-Wint-conversion]
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
          ^        ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/camerons/.rvm/gems/ruby-2.2.0/gems/json-1.8.0 for inspection.
Results logged to /Users/camerons/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0/json-1.8.0/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 1.8.0并得到此错误。

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/camerons/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150331-884-1wle120.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
/Users/camerons/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ (    \
        ^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' [-Wint-conversion]
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
          ^        ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/camerons/.rvm/gems/ruby-2.2.0/gems/json-1.8.0 for inspection.
Results logged to /Users/camerons/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0/json-1.8.0/gem_make.out

我知道它不是xcode,因为它说已经安装了,我只是在其上运行了最新的软件更新。

任何建议都将不胜感激!

4 个答案:

答案 0 :(得分:1)

今天发生在osx yosemite上的json 1.7.3宝石,我不知道为什么。我尝试了几乎所有为这个问题推荐的东西 - 设置Archflags,更新命令行工具等。我相信我想运行的项目太旧了(没有版本的gem install json工作得很好)而且我放弃了它。我坦率地不知道为什么捆绑安装试图加载json 1.7.3反正。

尝试使用gemsets来保持所有应用依赖项彼此分离。有时这可以解决问题。

rvm gemset create [some name]
rvm gemset use [some name]
bundle install

我希望这有帮助!我知道这不是一个真正的答案,但stackoverflow不会让我评论,直到我有更多的声誉点。我会关注你的问题,看看是否有人能给你答案。

答案 1 :(得分:1)

似乎json-1.8.2在ruby 2.2.2下安装得很干净。我以前遇到过同样的问题。

答案 2 :(得分:1)

那是因为json版本不兼容;尝试将Gemfile修改为最新的gem。请参阅this answer

答案 3 :(得分:0)

我遇到了同样的问题,因为我的代码(repo)使用的是旧版本的Ruby。

当我cd到目录时,我收到了这条消息:

furian:Hetzner danebalia$ cd X_installer/
ruby-1.9.3-p194 is not installed.
To install do: 'rvm install ruby-1.9.3-p194'

安装缺少版本的Ruby后,错误就消失了。