如何在Windows上为ruby安装'byebug'?[英] How do I install 'byebug' for ruby on Windows?

本文是小编为大家收集整理的关于如何在Windows上为ruby安装'byebug'?的处理方法,想解了如何在Windows上为ruby安装'byebug'?的问题怎么解决?如何在Windows上为ruby安装'byebug'?问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我是 ruby​​ 新手,正在尝试设置我的开发环境 (Windows 10).我已经安装了 ruby​​ 和 rails 但无法安装 byebug.根据我的阅读,我首先需要 DevKit.所以我按照这里的指南安装了它:

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

然后尝试安装 gem 但没有运气.我尝试卸载然后强制安装 DevKit,但仍然无法安装 byebug.这就是我所看到的:

C:\RubySDK>gem install byebug
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing byebug:
        ERROR: Failed to build gem native extension.

    C:/Ruby22/bin/ruby.exe -r ./siteconf20150923-3628-5vg5h3.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating byebug-i386-mingw32.def
compiling breakpoint.c
In file included from c:/Ruby22/include/ruby-2.2.0/ruby.h:33:0,
                 from ./byebug.h:4,
                 from breakpoint.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:111:14: error: size of array 'ruby_check_sizeof_voidp' is negative
In file included from c:/Ruby22/include/ruby-2.2.0/ruby.h:33:0,
                 from ./byebug.h:4,
                 from breakpoint.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_obj_freeze_inline':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1156:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1157:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1158:6: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1158:27: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_data_object_get':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1192:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_obj_written':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1271:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1271:34: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_num2char_inline':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:36: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:36: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1344:36: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1345:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1345:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1345:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_class_of':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1670:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h: In function 'rb_type':
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:1687:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c: In function 'eval_expression':
breakpoint.c:21:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:21:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:21:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c: In function 'filename_cmp_impl':
breakpoint.c:288:11: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:288:11: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:288:11: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:292:16: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:292:16: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:292:16: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c: In function 'find_breakpoint_by_pos':
breakpoint.c:458:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:458:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:458:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:460:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:460:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:460:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c: In function 'find_breakpoint_by_method':
breakpoint.c:480:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:480:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
breakpoint.c:480:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1.exe: all warnings being treated as errors
make: *** [breakpoint.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby22/lib/ruby/gems/2.2.0/gems/byebug-6.0.2 for inspection.
Results logged to C:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/byebug-6.0.2/gem_make.out

还有其他方法可以解决这个问题吗?谢谢

推荐答案

我知道这是一个迟到的回复!

但是当你在使用 DevKit 遇到困难时,在这种情况下使用原生 gem,例如 buybug 或 json,你必须知道如果你的系统类型是 64 位,你必须使用 RubyInstaller 64 位,而 DevKit 64少量.使用 32 位系统类型遵循相同的原则,使用 RubyInstaller 32 位和 DevKit 32 位.

另外不要忘记在安装 ruby​​ 和 rails 和 DevKit 之后运行一些命令,通过终端(Windows 中的 cmd)永久安装 DevKit 并运行:

命令:

  1. ruby dk.rb init - 这将创建配置文件
  2. 然后运行 ​​ruby dk.rb install

干杯和快乐编码.伊布拉克斯.

本文地址:https://www.itbaoku.cn/post/786357.html