在本地安装ruby-debug19

我目前在Windows XP 32位机器上运行Ruby 1.9.2p0。 自从我们升级到Ruby 1.9以来,我无法进行任何forms的调试。 我被告知你需要新的ruby-debug19 gem才能让事情运行起来。 问题是,我公司的代理阻止了gem依赖管理器连接外部存储库。 没关系,我只是自己下载gem并在本地安装它。 结果:

ERROR: Error installing ruby-debug19-0.11.6.gem: ERROR: Failed to build gem native extension. C:/Ruby192/bin/ruby.exe extconf.rb --with-ruby-include=C:\Ruby192\include checking for vm_core.h... no checking for vm_core.h... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby192/bin/ruby --with-ruby-dir --without-ruby-dir --with-ruby-include=${ruby-dir}/include --with-ruby-lib --without-ruby-lib=${ruby-dir}/lib C:/Ruby192/lib/ruby/1.9.1/net/http.rb:644:in `initialize': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - connect(2) (Errno::ETIMEDOUT) from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:644:in `open' from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:644:in `block in connect' from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:44:in `timeout' from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:87:in `timeout' from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:644:in `connect' from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:637:in `do_start' from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:626:in `start' from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1160:in `request' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:239:in `block in read' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:286:in `connect' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:234:in `read' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:128:in `download' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/ruby_core_source.rb:55:in `block in create_makefile_with_core' from C:/Ruby192/lib/ruby/1.9.1/tempfile.rb:320:in `open' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.4/lib/ruby_core_source.rb:51:in `create_makefile_with_core' from extconf.rb:20:in `' Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.gz Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/linecache19-0.5.11 for inspection. Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/linecache19-0.5.11/ext/trace_nums/gem_make.out 

也许我做了不合理的假设,因为我对Ruby很新,但看起来安装脚本试图连接外部存储库以获取某些内容。 如果是这样,这是荒谬的,为什么我会在本地安装一个gem,如果我能够自动与管理员这样做? 有没有人知道我可以以纯粹的本地离线方式安装调试器? 我感谢任何帮助。

我有完全相同的问题,我第二个Luis Lavena – 只需将所有* .h和* .inc文件从ruby源复制到此命令打印出来的目录:

 ruby -rmkmf -e 'puts Config::CONFIG["rubyhdrdir"] + "/" + "ruby-" + RUBY_VERSION.to_s + "-p" + RUBY_PATCHLEVEL.to_s' 

然后ruby_core_source将找到这些并愉快地继续安装。

我以前遇到过同样的问题,虽然我不是代理人。 也许这个解决方案有帮助。 ruby-debug19 gem依赖于linecache19ruby-debug-base19 (以及Luis提到的其他一些)。 不确定后者,但前者不带有Windows的二进制文件,这是我的问题的根源。 为了在本地正确安装,您应该将gems下载到目录,然后执行gem install -l ,就像您可能那样。 所有必要的gem都可以从这里下载。

由于linecache19没有附带win32二进制文件,它将尝试通过编译源代码来“构建本机扩展”。 这在大多数Windows计算机上都会失败,除非你有VC6编译器,或者通过这个链接安装了dev-kit。 此程序包要求您使用windows的ruby安装程序安装ruby 。 一旦安装了dev-kit,就不应该在“构建本机扩展”上获得失败。

你可以在这里阅读一个很好的简短概述。

希望这可以帮助..

Ruby 1.9的ruby-debug使用Ruby 1.9的某些特性,它没有暴露在普通的头文件中(内部)

因此,ruby-debug将尝试下载与您的Ruby版本匹配的源包,并在编译阶段提取这些头。

我同意这是荒谬的,但由于它使用了Ruby内部头文件的某些未记录的function,因此无法解决。

这是由ruby_core_source gem触发的,您可以在此处检查其源代码

我建议您使用浏览器下载您的Ruby版本的精确补丁级别(在上面提供的输出中指出)并查看ruby_core_source操作,在指定位置提取头文件,请参阅ruby_core_source.rb的第38行

如果您使用RVM,

您可以考虑查看此URL: – http://isitruby19.com/linecache19

为我工作..

也,

在一个阶段,我甚至不得不手动下载gem并使用“-l”命令使用gem install来使事情正常工作..同样的命令是……

 mohnish@mohnish-desktop:~/Downloads/Diaspora_new_gems/mar10$ gem install ruby-debug19-0.11.6.gem -l -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p180/ Building native extensions. This could take a while... Successfully installed linecache19-0.5.12 Successfully installed ruby-debug19-0.11.6 2 gems installed Installing ri documentation for linecache19-0.5.12... Installing ri documentation for ruby-debug19-0.11.6... Installing RDoc documentation for linecache19-0.5.12... Installing RDoc documentation for ruby-debug19-0.11.6... mohnish@mohnish-desktop:~/Downloads/Diaspora_new_gems/mar10$ ls mohnish@mohnish-desktop:~/Downloads/Diaspora_new_gems/mar10$ gem install ruby-debug-base19-0.11.25.gem -l -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p180/. Building native extensions. This could take a while... Successfully installed ruby-debug-base19-0.11.25 1 gem installed Installing ri documentation for ruby-debug-base19-0.11.25... Installing RDoc documentation for ruby-debug-base19-0.11.25... mohnish@mohnish-desktop:~/Downloads/Diaspora_new_gems/mar10$ 

根据您的Ruby版本(136,或180或..)进行适当更改。 我刚刚添加了一个类似的安装wrt另一个gem ruby-debug-base19-0.11.25 ,供参考。

我使用exe安装程序安装了ruby 1.9.3。 但我发现了如何使这个东西工作。 我打开了名为’ ruby_core.rb ‘的文件。 因为错误就在那里。

我发现这部分代码无法下载源代码。

  # # Download the headers # uri_path = "http://ftp.ruby-lang.org/pub/ruby/1.9/" + ruby_dir + ".tar.gz" Tempfile.open("ruby-src") { |temp| temp.binmode uri = URI.parse(uri_path) uri.download(temp) tgz = Zlib::GzipReader.new(File.open(temp, "rb")) FileUtils.mkdir_p(dest_dir) Dir.mktmpdir { |dir| inc_dir = dir + "/" + ruby_dir + "/*.inc" hdr_dir = dir + "/" + ruby_dir + "/*.h" Archive::Tar::Minitar.unpack(tgz, dir) FileUtils.cp(Dir.glob([ inc_dir, hdr_dir ]), dest_dir) } } 

所以我从那里得到了链接,手动创建的目录应该在’ ruby_dir ‘变量中,并通过该链接下载所有源。

为了找出如何调用这个目录,我从顶部剪切了几行代码并通过控制台使用IRB运行它。

  inc_dir = dir + "/" + ruby_dir + "/*.inc" hdr_dir = dir + "/" + ruby_dir + "/*.h" 

所以你们都需要查看dir(提到的地方的完整路径)和ruby_dir来为所有源创建一个目录。

祝好运!

Gem确实支持代理。 你可以摆弄这两个参数:

         --source URL使用URL作为gems的远程源
     -p, -  [no-] http-proxy [URL]使用HTTP代理进行远程操作

OSX 10.6.8和rvm在我身上发生了这种情况,本页的答案起了作用
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p180/
只需将ruby-1.9.2改为你正在使用的ruby

这对我有用

 $ echo $rvm_path/src/$(rvm tools strings) $ rvm @global gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/$(rvm tools strings) 

感谢http://isitruby19.com/linecache19