14

重複の可能性:
Rails3.1およびRuby1.9.3p125:ruby-debug19は、「シンボルが見つかりません:_ruby_threadptr_data_type」でクラッシュします。

コンソールへの印刷は終了です。20世紀に移行してデバッガーを使い始めたいです。しかし、ruby-debugをインストールするにはどうすればよいですか?ruby-debug.cruby-debug19 gemをインストールしようとすると、のネイティブコンパイルが失敗します。他のSOの投稿を調べましたが、まだ答えが見つかりません...

  • Ruby1.9.3-p0を使用しています
  • Rails 3.2を使用しています(もちろんGemfileを使用)
  • 私はRVMを使用していません-代わりに、すべての実行可能ファイル、gem、ソースなどを含む完全にサンドボックス化されたディレクトリがあります。以下では$SANDBOXと呼びます...

バンドルインストールが機能しない

Ruby-debug19をGemfileに追加して実行するとbundle install、ビルド中に次のコマンドで失敗しますconflicting types for 'rb_iseq_compile_with_option'

# file: Gemfile
...
group :development do
  gem 'ruby-debug19'
end
...

% bundle install
...
Installing ruby-debug-base19 (0.11.25) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
        /Users/r/Developer/Topaz/usr/bin/ruby extconf.rb 
...
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here
...
make: *** [ruby_debug.o] Error 1

コマンドラインからのgeminstallruby-debugが機能しない

include現在のrubyのディレクトリを指す--with-ruby-include引数を使用して、コマンドラインからgemをビルドしようとすると、同じエラーが発生します。

% gem install ruby-debug19 -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug19:
        ERROR: Failed to build gem native extension.

        $SANDBOX/usr/bin/ruby extconf.rb --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0/include
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... yes
creating Makefile

make
compiling breakpoint.c
compiling ruby_debug.c
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here

私は何が欠けていますか?

--with-ruby-includeは何か違うことを期待していますか?現在のruby-debug19は壊れていますか?

4

2 に答える 2

19

OPでの@MarcTalbotのコメントのおかげで、実用的なレシピを見つけました。

RubyForgeからlinecache19とruby-debug-base19をダウンロードします。

% curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
% curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem

2つの宝石をコンパイルします

% gem install linecache19-0.5.13.gem
Building native extensions.  This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
...
% gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions.  This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
...

Gemfileを更新します

# file: Gemfile
...
group :development do
  gem 'linecache19', '0.5.13'
  gem 'ruby-debug-base19', '0.11.26'
  gem 'ruby-debug19', :require => 'ruby-debug'
end

デバッガーのバンドルインストールとテスト

% bundle install
Fetching source index for http://rubygems.org/
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
% irb
irb(main):001:0> require 'ruby-debug'
=> true
irb(main):002:0> debugger
$SANDBOX/usr/lib/ruby/1.9.1/irb/context.rb:166
@last_value = value
(rdb:1) p 'hooray'
"hooray"

うまくいけば、これは他の人を助けるでしょう。

于 2012-02-03T05:30:49.760 に答える
2

(ログから、Linux、特に Debian ディストリビューションを使用していると推測されます) これには簡単な解決策があります: シェルでは、

sudo apt-get install ruby-dev1.9.3

注: 1.9.2用ruby-dev1.9.3にインストールしたので、というパッケージがあるかどうかは実際にはわかりません(それは少し前だったと思います。誰かがそれらが何であるかを知っている場合は、コメントしてください)。ruby-devruby-dev1.9

このパッケージは、インタープリターに対する C 拡張機能が必要とするヘッダーをインストールします ( ruby.h)。

于 2012-02-03T02:00:22.430 に答える