【问题标题】:Installing ruby-debug19 locally在本地安装 ruby​​-debug19
【发布时间】:2010-11-12 21:26:44
【问题描述】:

我目前在 Windows XP 32 位机器上运行 Ruby 1.9.2p0。自从我们升级到 Ruby 1.9 后,我根本无法进行任何形式的调试。有人告诉我,您需要新的 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 `<main>'
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,为什么还要在本地安装gem?有人知道我可以以纯本地离线方式安装调试器的方法吗?感谢您的帮助。

【问题讨论】:

    标签: ruby ruby-1.9 ruby-debug


    【解决方案1】:

    我遇到了完全相同的问题,我第二次是 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​​ 目录中找不到 *.inc 文件:-(
    • 您的 ruby​​ 目录是否已从源代码库中签出,例如svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_2 ?
    • 谢谢!我下载了ruby-sources 的正确版本/补丁级别,然后将它们解压缩到上述文件夹中。请注意,下载的打包文件包含一个与上面给出的命令中的最后一个文件夹同名的根文件夹。
    【解决方案2】:

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

    由于 linecache19 不附带 win32 二进制文件,它会尝试通过编译源代码来“构建原生扩展”。这将在大多数 Windows 计算机上失败,除非您有 VC6 编译器,或者按照 this link 安装开发工具包。此软件包要求您使用ruby installer for windows 安装 ruby​​。一旦安装了开发工具包,您就不应该在“构建原生扩展”时遇到失败。

    您可以阅读一篇不错的简短概述here

    希望这会有所帮助..

    【讨论】:

      【解决方案3】:

      Ruby 1.9 的 ruby​​-debug 使用了 Ruby 1.9 的某些特性,而这些特性并没有在普通头文件(内部)中公开

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

      我同意这是荒谬的,但由于它使用了 Ruby 内部标头的某些未记录的特性,所以没有办法。

      这是由 ruby​​_core_source gem 触发的,你可以查看它的源代码here

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

      【讨论】:

        【解决方案4】:

        如果您使用 RVM,

        你可以考虑看看这个网址:-http://isitruby19.com/linecache19

        为我工作..

        还有,

        在某个阶段,我什至不得不手动下载 gems 并使用带有“-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 another gem ruby-debug-base19-0.11.25 ,供参考。

        【讨论】:

          【解决方案5】:

          我使用 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 来为所有源创建一个目录。

          祝你好运!

          【讨论】:

            【解决方案6】:

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

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

            【讨论】:

              【解决方案7】:

              OSX 10.6.8 和 rvm 发生在我身上,下面来自 this page 的答案工作
              gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p180/
              只需将 ruby​​-1.9.2... 更改为您正在使用的任何 ruby​​

              【讨论】:

                【解决方案8】:

                这对我有用

                $ 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

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  相关资源
                  最近更新 更多