gem install debugger -v’1.5.0’失败

我试图在小牛队的大型项目中做bundle ,虽然这是rbenv的全新安装,但是我的环境有些gem坏了或者出了什么问题。

 $ gem install debugger -v '1.5.0' Building native extensions. This could take a while... ERROR: Error installing debugger: ERROR: Failed to build gem native extension. /Users/samat/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb checking for rb_method_entry_t.called_id in method.h... no checking for rb_control_frame_t.method_id in method.h... no checking for rb_method_entry_t.called_id in method.h... no checking for rb_control_frame_t.method_id in method.h... no Makefile creation failed ************************************************************************** No source for ruby-1.9.3-p448 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. ... 

不知道我需要什么配置选项

在mkmf我看到的东西

 "gcc -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/x86_64-darwin13.0.0 -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1 -I. -I/Users/samat/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby-1.9.3-p448 -I'/Users/samat/.rbenv/versions/1.9.3-p448/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/samat/.rbenv/versions/1.9.3-p448/include' -O3 -Wno-error=shorten-64-to-32 -pipe -c conftest.c" conftest.c:3:10: fatal error: 'method.h' file not found #include  ^ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include  ... 

我用rbenv,

 $ rbenv version 1.9.3-p448 (set by /Users/samat/Documents/bm-git/.ruby-version) 

你最好使用最新版本的调试器,你的Ruby版本的bc 问题就解决了。

从调试器页面可以看出,如果找不到ruby源,它将尝试安装debugger-ruby_core_source,这实际上对我来说是失败的。 我使用rbenv,所以我根据调试器gem指令,将其指向rbenv源代码。

gem install debugger -- --with-ruby-include=~/.rbenv/versions/1.9.3-p484/include

Ruby gem和Mavericks存在很多问题。 我发现最好的办法是使用自制的apple-gcc42编译器

 brew tap homebrew/versions brew install apple-gcc42 

然后在构建gem时强制使用该编译器系列。 我将符号链接放在我的主目录中的bin文件夹中

 cd $HOME/bin ln -s /usr/local/bin/c++-4.2 c++ ln -s /usr/local/bin/g++-4.2 g++ ln -s /usr/local/bin/gcc-4.2 cc ln -s /usr/local/bin/gcc-4.2 gcc 

您需要在路径中包含本地bin文件夹。

 export PATH=$HOME/bin:$PATH 

然后你应该好好去。

可能这将帮助你gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p286/

有时这个问题与丢失的包有关。 大多数情况下,这些文件(例如libXXX-dev )属于名为libXXX-dev包。

我们很难知道包中包含的文件。 我最近碰到了一个实用工具来处理这个恼人的问题(对于那些使用apt-get包管理器的人)。 该工具是apt-file ,您可以按如下方式使用它:

  1. 安装: sudo apt-get install apt-file
  2. 更新apt-file db: sudo apt-file update
  3. 查看文件: sudo apt-file search 'method.h'

结果可能是:

 ... libcxxtools-dev: /usr/include/cxxtools/constmethod.h libcxxtools-dev: /usr/include/cxxtools/method.h libcxxtools-dev: /usr/include/cxxtools/unit/testmethod.h libgcj12-dev: /usr/include/c++/4.6/gcj/method.h libgcj13-dev: /usr/include/c++/4.7/gcj/method.h ... 

debugger gem的特定情况下,缺少的包是`libcxxtools-dev“

我在Debian 3.2.54-2 x86_64 GNU / Linux上

对我来说这是一个许可问题。

我能够解决这个问题

sudo gem安装调试器

如果这没有帮助,你可能不得不卷入一个依赖兔子洞。