如何安装json gem-无法构建gem本机扩展(mac 10.10) [英] How to install json gem - Failed to build gem native extension(mac 10.10)

查看:169
本文介绍了如何安装json gem-无法构建gem本机扩展(mac 10.10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

操作系统:Mac OS X 10.10.3 X代码:最新安装了命令行工具(6.3版)Rails:4.2.1版Ruby:2.2.1版

当我收到错误消息时,我正在尝试为我正在处理的项目生成路由(定期执行此操作),并建议我捆绑安装并捆绑exec.我这样做了,这一次,在编译JSON Gem(版本1.7.7)时,该过程中断了.

I was trying to generate the routes for a project I am working on (been doing that on regular basis), when I got an error message, with a recommendation that I do bundle install and bundle exec. I did, and this time around, the process broke off while compiling the JSON Gem (version 1.7.7).

对StackOverflow进行了一些研究,建议是更新Xcode的命令行工具,我这样做了,但这并不能解决问题.

Doing some research on StackOverflow, the recommendation was to update the Xcode's command line tools, and I did, but that did not solve the problem.

我尝试单独安装JSON 1.7.7版,但失败了,并告诉我要在以下位置查找错误日志:

I tried installing the JSON version 1.7.7 separately, and it failed, telling me to look for the error log in:

/Users/zwb/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150411-36070-1t083xl.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/zwb/.rvm/rubies/ruby-2.2.1/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

推荐答案

不幸的是,JSON-1.7.7(以及最高1.8.1)是

Sad, however, JSON-1.7.7 (and upto 1.8.1) is incompatible with Ruby-2.2.x. As you are using Ruby-2.2.1, it will not work for you.

为您提供2种选择:

  1. 将您的json gem更新为1.8.2版本. -首选
  2. 编辑ruby-2.2.1/ext/json/fbuffer/fbuffer.h文件,并用VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));替换有问题的代码.详情请此处
  1. Update your json gem to 1.8.2 version. -- Preferable
  2. Edit ruby-2.2.1/ext/json/fbuffer/fbuffer.h file and replace problematic code with VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));. Look here for details

这篇关于如何安装json gem-无法构建gem本机扩展(mac 10.10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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