Gem json 1.8.1 的安装问题

onenewlife · 2016年07月23日 · 最后由 luikore 回复于 2016年07月23日 · 3800 次阅读

OS: Fedora 24 Ruby: 2.3.1p112 Rails: 5.0.0

始终无法安装 json 1.8.1,macro "rb_str_new" 函数缺少一个参数?

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

    current directory: /home/mwong/.rvm/gems/ruby-2.3.1/gems/json-1.8.1/ext/json/ext/generator
/home/mwong/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160723-13339-1j64org.rb extconf.rb
creating Makefile

current directory: /home/mwong/.rvm/gems/ruby-2.3.1/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/mwong/.rvm/gems/ruby-2.3.1/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^~~~~~~~~~
Makefile:238: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/mwong/.rvm/gems/ruby-2.3.1/gems/json-1.8.1 for inspection.
Results logged to /home/mwong/.rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/json-1.8.1/gem_make.out

升级到 json 1.8.3 或者用更新的 2.0.1

#1 楼 @luikore 请问一下 Rails 4.1.2 或者 jbuilder 2.0 的项目是不是只能用 json 1.8.1

#2 楼 @onenewlife 你把 Gemfile 的依赖改成 1.8.3 应该没问题的

需要 登录 后方可回复, 如果你还没有账号请 注册新账号