3

現在、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 をインストールするのでしょうか? 純粋にローカルでオフラインの方法でデバッガーをインストールできる方法を知っている人はいますか? 助けていただければ幸いです。

4

8 に答える 8

8

私はまったく同じ問題を抱えていて、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 がそれらを見つけて、インストールを続行します。

于 2010-11-13T10:39:37.787 に答える
3

プロキシの背後にいるわけではありませんが、以前も同じ問題がありました。たぶん、この解決策が役立ちます。gem はand (および Luis が言及した他のいくつか)にruby-debug19依存しています。後者についてはわかりませんが、前者には問題の原因となった Windows 用のバイナリが付属していません。ローカルに正しくインストールするには、gem をディレクトリにダウンロードしてから、おそらく行ったように を実行する必要があります。必要なすべての gem は、ここからダウンロードできます。linecache19ruby-debug-base19gem install -l

linecache19 には win32 バイナリが同梱されていないため、ソース コードをコンパイルして「ネイティブ拡張機能を構築」しようとします。これは、ほとんどの Windows コンピューターでは失敗します。ただし、VC6 コンパイラーがインストールされているか、代わりにこのリンクに従って開発キットがインストールされている場合を除きます。このパッケージでは、Windows 用の Ruby インストーラーを使用して Ruby をインストールする必要があります。開発キットがインストールされると、「ネイティブ拡張機能のビルド」でエラーが発生することはありません。

ここで簡単な概要を読むことができます。

お役に立てれば..

于 2010-11-15T06:27:11.247 に答える
1

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 を確認する必要があります。

幸運を!

于 2012-02-01T06:15:06.117 に答える
1

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、または..) に基づいて適切に変更します。参考のために、別のgem ruby​​-debug-base19-0.11.25 に関して同様のインストールを追加しました。

于 2011-04-12T08:32:00.260 に答える
1

Ruby 1.9 の ruby​​-debug は、通常のヘッダー (内部) では公開されていない Ruby 1.9 の特定の機能を使用します。

そのため、ruby-debug は、Ruby バージョンに一致するソース パッケージをダウンロードし、コンパイル フェーズ中にこれらのヘッダーを抽出しようとします。

ばかげていることに同意しますが、Ruby 内部ヘッダーの特定の文書化されていない機能を使用しているため、回避策はありません。

これは ruby​​_core_source gem によってトリガーされ、ここでソースコードを調べることができます

ブラウザーを使用して、Ruby のバージョンの正確なパッチレベル (上記の出力に示されています) をダウンロードし、ruby_core_source アクションを確認して、指定された場所にあるヘッダー ファイルを抽出することをお勧めします。ruby​​_core_source.rb の 38 行を参照してください。

于 2010-11-12T21:57:06.223 に答える
0

これは私のために働いた

$ 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に感謝

于 2011-12-27T10:03:42.167 に答える
0

これはOSX 10.6.8とrvmで私に起こっていました.このページ
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p180/
からの以下の答え は、ruby-1.9.2 ...を使用しているルビーに変更するだけで機能しました

于 2011-07-19T11:58:18.167 に答える
0

Gem はプロキシをサポートしています。次の 2 つのパラメーターをいじることができます。

        --source URL gem のリモート ソースとして URL を使用します。
    -p, --[no-]http-proxy [URL] リモート操作に HTTP プロキシを使用
于 2010-11-12T23:25:15.577 に答える