3
我刚刚首次从GitHub克隆了一个存储库。错误:安装oj时出错:
我去看看我的本地机器上,所以我的Mac上的本地仓库内我跑以下命令
斌/导轨服务器
我得到了以下错误:
无法在任何来源中找到activesupport-5.0.0.1 运行bundle install
以安装缺失的宝石。
所以我然后跑捆绑安装命令的建议,但随后它给了我下面的错误
在安装OJ(14年2月12日)发生了错误,并且捆扎机无法继续。 确保gem install oj -v '2.12.14'
在捆绑之前成功。
所以的建议,我跑:创业板安装OJ -v“14年2月12日”
然后我得到的警告很长的信息及错误(见下文)。有什么想法吗?
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 = RSTRUCT_PTR(obj); 0 < i; i--, 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, 0, 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
我试着升级oj到2.16.1,它工作。然而,当我尝试捆绑安装时,它又给了我同样的错误,说确保'gem install oj -v'2.12.14''捆绑成功。所以,下一个想法是按照你的建议降级Ruby,但是我怎样才能做到这一点呢?我认为我遇到的问题是我已成功设置ruby,但是我克隆了一个存储库,可能它的代码依赖于旧版本的ruby或不同版本的oj。我假设我应该使用RVM以某种方式为此存储库设置Ruby版本? –
@KramerKeller你需要在运行'bundle install'前运行'bundle update oj'来更新oj到Gemfile.lock中的最新版本。据说,使用rvm或其他管理器来管理你的ruby安装总是一个好主意。大多数管理者通过在目录中查找_.ruby-version_文件来确定要使用哪个版本的ruby。如果您克隆的存储库已经有一个,我不会感到惊讶。 – eiko
我完全删除了RVM。我也删除了我的存储库。我创建了一个新文件并克隆了存储库并使rbenv工作。我可以看到我在本地运行2.3.1,但我仍然遇到同样的错误。它说“安装oj(2.12.14)时发生错误,并且Bundler无法继续。”捆绑更新oj给出了相同的错误。宝石安装似乎引用红宝石2.4 ...所以如何获得2.3.1的宝石与我的克隆回购工作?我也检查了我的gem文件,它说'oj','〜> 2.12.14'和Gemfile.lock说oj(2.12.14)。我正在尝试学习红宝石......但无法在我的机器上运行。 –