操作系统:Mac OS X 10.10.3 XCode:最新安装了命令行工具(6.3版)Rails:4.2.1版Ruby:2.2.1版
当我收到一条错误消息时,我试图为正在处理的项目生成路由(定期执行此操作),并建议我捆绑安装并捆绑执行。我这样做了,这一次,编译JSON Gem(版本1.7.7)的过程中断了。
对StackOverflow进行了一些研究,建议是更新Xcode的命令行工具,我这样做了,但是并没有解决问题。
我尝试单独安装JSON版本1.7.7,但失败,并告诉我在登录时查找错误:
/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)与Ruby-2.2.x 不兼容。当您使用Ruby-2.2.1时,它对您不起作用。
有两个选项供您选择:
json
1.8.2
ruby-2.2.1/ext/json/fbuffer/fbuffer.h
VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));