---
title: "ruby 1.9 rails 3.1 ruby debug的问题 "
author: "夜鸣猪"
date: "2011-12-20T23:06:18Z"
tags: []
categories: ["编程语言"]
slug: "ruby-1-9-rails-3-1-ruby-debug"
draft: false
lastmod: "2015-05-13T04:33:11Z"
id: 1318667
url: "https://hlee.iteye.com/blog/1318667"
---

<span style="color:red">update(2015/05/12):</span>
for rbenv



```ruby
gem install debugger -- --with-ruby-include=/home/hlee/.rbenv/versions/1.9.2-p330/lib/ruby/gems/1.9.1
```



<span style="color:red">update (2012/11/13) :</span>
Update ruby to 1.9.3-p327 got the same problem of debugger-linecache and 


```java

checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p327 provided with debugger-ruby_core_source gem.


```


solution is same


```java

gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p327

```


<span style="color:red">更新（2012/10/16）：</span>
<span style="color:green">升级ruby 1.9.3-p286遇到debugger-linecache 问题，见后
pry就没有这个问题，推荐大家debugger用pry-nav pry-remote吧，基本都一样
</span>

我是装linecache19出的问题

```ruby
gem install linecache19-0.5.13.gem 
```



> 
> Installing linecache19 (0.5.12) with native extensions
> /Users/joseph/.rvm/rubies/ruby-1.9.2p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions':
> ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
> 
> /Users/joseph/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
> 

问题ms是rvm找不到ruby对应版本，所以就

```ruby
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p290
```




```ruby

gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19'

```


Here is the problem again:



> 
> 
> Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
> 
>         /home/livegamer/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb 
> checking for vm_core.h... no
> checking for vm_core.h... no
> Makefile creation failed
> **************************************************************************
> No source for ruby-1.9.3-p286 provided with debugger-ruby_core_source gem.
> **************************************************************************
> *** 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=/home/livegamer/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
> 	--with-ruby-dir
> 	--without-ruby-dir
> 	--with-ruby-include
> 	--without-ruby-include=${ruby-dir}/include
> 	--with-ruby-lib
> 	--without-ruby-lib=${ruby-dir}/lib
> 
> 
> Gem files will remain installed in /home/livegamer/.rvm/gems/ruby-1.9.3-p286/gems/debugger-linecache-1.1.2 for inspection.
> Results logged to /home/livegamer/.rvm/gems/ruby-1.9.3-p286/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out
> An error occurred while installing debugger-linecache (1.1.2), and Bundler cannot continue.
> Make sure that `gem install debugger-linecache -v '1.1.2'` succeeds before bundling.
> 
> 


and Here is the solution:

gem install debugger-linecache -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p286
Building native extensions.  This could take a while...