微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – 错误:安装oj时出错:

我刚刚第一次从 GitHub克隆了一个存储库.

我去了我的本地机器,所以在我的Mac上的本地存储库中运行以下命令

bin / rails服务器

我收到以下错误

无法在任何来源中找到activesupport-5.0.0.1
运行bundle install以安装缺少的gem.

所以我按照建议运行了bundle install命令,但后来它给了我以下错误

安装oj(2.12.14)时发生错误,Bundler无法继续.
在捆绑之前确保gem install oj -v’2.12.14’成功.

所以我按照建议运行:gem install oj -v’2.12.14′

然后我得到了一个非常长的消息,警告和错误(见下文).有什么想法吗?

ERROR:  Error installing oj:
ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj

/usr/local/opt/ruby/bin/ruby -r ./siteconf20170218-3717-1p2bvl9.rb extconf.rb

>>>>> Creating Makefile for ruby version 2.4.0 on x86_64-darwin16 <<<<<

creating Makefile



current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj

make "DESTDIR=" clean



current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj

make "DESTDIR="

compiling cache8.c

compiling Circarray.c

compiling compat.c

compiling dump.c

dump.c:503:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]

        cnt = RSTRING_LEN(rstr);

            ~ ^~~~~~~~~~~~~~~~~

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:976:6: note: expanded from macro 'RSTRING_LEN'

     RSTRING_EMbed_LEN(str) : \

     ^~~~~~~~~~~~~~~~~~~~~~

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:972:6: note: expanded from macro 'RSTRING_EMbed_LEN'

     (long)((RBASIC(str)->flags >> RSTRING_EMbed_LEN_SHIFT) & \

     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

dump.c:503:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]

        cnt = RSTRING_LEN(rstr);

            ~ ^~~~~~~~~~~~~~~~~

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:977:28: note: expanded from macro 'RSTRING_LEN'

     RSTRING(str)->as.heap.len)

     ~~~~~~~~~~~~~~~~~~~~~~^~~

dump.c:1776:39: warning: 'rb_struct_ptr' is deprecated [-Wdeprecated-declarations]

        for (i = (int)RSTRUCT_LEN(obj),vp = RSTRUCT_PTR(obj); 0 < i; i--,vp++) {

                                             ^

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1190:33: note: expanded from macro 'RSTRUCT_PTR'

#define RSTRUCT_PTR(st)         rb_struct_ptr(st)

                                ^

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/intern.h:889:25: note: 'rb_struct_ptr' has been explicitly marked deprecated here

DEPRECATED(const VALUE *rb_struct_ptr(VALUE s));

                        ^

dump.c:1776:37: warning: assigning to 'VALUE *' (aka 'unsigned long *') from 'const VALUE *' (aka 'const unsigned long *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

        for (i = (int)RSTRUCT_LEN(obj),vp++) {

                                           ^ ~~~~~~~~~~~~~~~~

4 warnings generated.

compiling err.c

compiling fast.c

fast.c:816:17: warning: 'rb_data_object_alloc' is deprecated: by rb_data_object_wrap [-Wdeprecated-declarations]

    doc->self = rb_data_object_alloc(clas,doc,free_doc_cb);

                ^

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1379:1: note: 'rb_data_object_alloc' has been explicitly marked deprecated here

rb_data_object_alloc(VALUE klass,void *data,RUBY_DATA_FUNC dmark,RUBY_DATA_FUNC dfree)

^

fast.c:1280:24: error: use of undeclared identifier 'rb_cFixnum'

        case T_FIxnuM:  type = rb_cFixnum;      break;

                               ^

1 warning and 1 error generated.

make: *** [fast.o] Error 1



make Failed,exit code 2



Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14 for inspection.

Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/oj-2.12.14/gem_make.out

解决方法

Fixnum不再是ruby2.4中的东西.要么降级你的ruby,要么将oj更新为2.16.1,它支持ruby 2.4.

原文地址:https://www.jb51.cc/ruby/264659.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐