簡體   English   中英

調試器 - 無法構建gem native native ruby​​ 1.8.7

[英]Debugger - Failed to build gem native extension ruby 1.8.7

處理我需要調試但無法安裝調試器的過時項目。

ruby -v  # => ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin12.3.0]
rails -v # => Rails 2.3.17

gem install debugger

Installing debugger (1.6.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/lfender/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
*** 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=/Users/lfender/.rvm/rubies/ruby-1.8.7-p352/bin/ruby
extconf.rb:16:in `require': no such file to load -- debugger/ruby_core_source (LoadError)
  from extconf.rb:16


Gem files will remain installed in /Users/lfender/.rvm/gems/ruby-1.8.7-p352@nhg/gems/debugger-1.6.1 for inspection.
Results logged to /Users/lfender/.rvm/gems/ruby-1.8.7-p352@nhg/gems/debugger-1.6.1/ext/ruby_debug/gem_make.out

An error occurred while installing debugger (1.6.1), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.1'` succeeds before bundling.

問題是阻止我調試一些失敗的規范。 任何幫助將不勝感激!

似乎調試器適用於Ruby 1.9.2和1.9.3,而ruby-debug可能更適合Ruby 1.8。

您可以嘗試使用ruby-debug

gem install ruby-debug

來自README:

運行ruby-debug有兩種方法。

rdebug可執行文件:

$ rdebug <your-script>

以這種方式啟動腳本時,調試器將停在腳本文件的第一行代碼中。 因此,您將能夠設置斷點。

ruby-debug API

第二種方法是使用ruby-debug API在運行時中斷代碼執行。

require 'ruby-debug' ; Debugger.start
...
def your_method
  ...
  debugger
  ...
end

要么

require 'ruby-debug' ; 
Debugger.start do 
  ...
  debugger
end

執行Kernel#debugger方法時,調試器將被激活,您將能夠檢查並逐步執行代碼。

或者,您可以將“調試器”移動到Gemfile中的開發塊中:

group :development, :test do
  gem 'debugger'
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM