2017-02-27 210 views
5

noob在這裏,我試圖安裝octopress,但是當我運行rbenv exec bundle install我得到了這個錯誤。錯誤捆綁安裝「yajl紅寶石」

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 
current directory: 
/home/idiot/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/yajl-ruby-1.2.1/ext/yajl 
/home/idiot/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170227-4161-uizrqn.rb extconf.rb 
creating Makefile 

current directory: 
/home/idiot/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/yajl-ruby-1.2.1/ext/yajl 
make "DESTDIR=" clean 

current directory: 
/home/idiot/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/yajl-ruby-1.2.1/ext/yajl 
make "DESTDIR=" 
compiling yajl.c 
compiling yajl_alloc.c 
compiling yajl_buf.c 
compiling yajl_encode.c 
compiling yajl_ext.c 
yajl_ext.c: In function ‘rb_yajl_parser_parse’: 
yajl_ext.c:471:17: warning: variable ‘stat’ set but not used [Wunused-but-set-variable] 
yajl_status stat; 
      ^~~~ 
yajl_ext.c: In function ‘rb_yajl_encoder_enable_json_gem_ext’: 
yajl_ext.c:881:22: error: ‘rb_cFixnum’ undeclared (first use in this function) 
rb_define_method(rb_cFixnum, "to_json", rb_yajl_json_ext_fixnum_to_json, -1); 
        ^~~~~~~~~~ 
yajl_ext.c:881:22: note: each undeclared identifier is reported only once for each 
function it appears in 
yajl_ext.c: At top level: 
cc1: warning: unrecognized command line option ‘-Wno-self-assign’ 
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ 
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’ 
make: *** [Makefile:242: yajl_ext.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in 
/home/idiot/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/yajl-ruby1.2.1 for inspection. 
Results logged to 
    /home/idiot/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/yajl-ruby-1.2.1/gem_make.out 

An error occurred while installing yajl-ruby (1.2.1), and Bundler cannot 
continue. 
Make sure that `gem install yajl-ruby -v '1.2.1'` succeeds before bundling. 

我一直在努力,谷歌搜索,但至今還沒有找到一個解決這個問題,有人回答我的問題,我非常感激。

回答

13

原生擴展尚未針對Ruby 2.4進行更新。突破變化是在Integerrb_cInteger)中統一了FixnumBignumrb_cFixnumrb_cBignum在C API中)。

檢查yajl-ruby存儲庫中是否存在修復Ruby 2.4兼容性的問題/請求,或暫時使用Ruby 2.3.3。

+0

感謝您的解釋和建議@ michael。 –

+0

請注意,習慣上SO是爲了upvote /接受幫助你的答案。這是讓其他人知道你的問題已經解決了。 –

+0

感謝隊友,我已經解決了這個問題 –