2013-07-18 107 views
3

處理過期的項目,我需要調試但無法管理安裝調試器。調試器 - 無法構建gem本機擴展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/[email protected]/gems/debugger-1.6.1 for inspection. 
Results logged to /Users/lfender/.rvm/gems/[email protected]/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. 

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

+0

'檢查mkmf.log文件的更多細節 。您可能需要配置選項.' 您能發佈此日誌嗎? –

回答

9

看起來好像debugger適用於Ruby 1.9.2 & 1.9.3,而ruby-debug可能更適合Ruby 1.8。

你可以嘗試使用ruby-debug有:

gem install ruby-debug 

自述:

有運行紅寶石調試的方法有兩種。

中,RDebug可執行:

$ rdebug <your-script>

當您啓動腳本這樣,調試器將停止在代碼在腳本文件的第一行。所以你可以設置你的斷點。

紅寶石調試API

第二種方法是使用紅寶石調試API來打斷你的代碼執行在運行時。

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

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

當執行Kernel#debugger方法,調試器被激活,你將能夠檢查並通過您的代碼步。

+0

工作得很好 - 謝謝! – lfender6445

-1

或者,你可以移動「調試」到開發區塊在你的Gemfile:

group :development, :test do 
    gem 'debugger' 
end 
相關問題