ruby-debug 由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19697359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:16:32  来源:igfitidea点击:

ruby-debug Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers

rubyruby-debug

提问by HXH

My Rails is 3.2.1.4, Ruby is 1.9.3p448.

我的 Rails 是3.2.1.4,Ruby 是1.9.3p448

I got an error when I install ruby-debug:

安装时出现错误ruby-debug

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug:
        ERROR: Failed to build gem native extension.

    /home/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby


Gem files will remain installed in /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46 for inspection.
Results logged to /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/gem_make.out

Who can tell me where the error is?

谁能告诉我错误在哪里?

采纳答案by skibum55

The error is in the mkmf.log file. That file should be located at /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/linecache/mkmf.log.

错误在 mkmf.log 文件中。该文件应位于/home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/linecache/mkmf.log.

If not, you can use

如果没有,您可以使用

sudo find / -name mkmf.log

to find it.

找到它。

To troubleshoot further, see "How to install Nokogiri Ruby gem with mkmf.log saying libiconv not found?"

要进一步排除故障,请参阅“如何使用 mkmf.log 安装 Nokogiri Ruby gem 说找不到 libiconv?

回答by Guster

I am using Mac El Capitan. In my case it was caused by the missing developer tool. I solved it by installing the developer tool via xcode-select --install. After that bundle install worked fine again.

我正在使用 Mac El Capitan。在我的情况下,它是由缺少开发人员工具引起的。我通过安装开发人员工具解决了这个问题xcode-select --install。在捆绑安装之后再次正常工作。

回答by kenorb

You're most likely missing some file headers (e.g. zlib or libiconv), so try installing them.

您很可能缺少某些文件头(例如 zlib 或 libiconv),因此请尝试安装它们。

Linux: sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev

Linux: sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev

OS X: brew install libiconv && xcode-select --install

操作系统: brew install libiconv && xcode-select --install

Otherwise check your mkmf.logfile for more specific details.

否则,请检查您的mkmf.log文件以获取更具体的详细信息。

回答by songyy

It seems to be a issue with permission of gcc.. however, if you're using OS X, you may encounter this issue if you've updated your XCode but haven't agree to their terms & conditions yet.. try typing gccin your terminal would show you what if you've agreed.

这似乎是与海湾合作委员会的权限的问题。但是,如果你使用的OS X,你可能会遇到这个问题,如果你已经更新您的Xcode,但还没有同意他们的条款和条件尚未..尝试打字gcc中如果你同意,你的终端会告诉你什么。

回答by heronsanches

The answer of kenorbworked for me on Ubuntu 16.04 when I was trying installing rails! Thanks! I followed these steps below for installing rails:

当我尝试安装 rails 时,kenorb的答案在 Ubuntu 16.04 上对我有用!谢谢!我按照以下步骤安装导轨:

  1. sudo apt-get install ruby-full
  2. sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev
  3. sudo gem install rails
  1. sudo apt-get install ruby​​-full
  2. 须藤 apt-get 安装 libz-dev libiconv-hook1 libiconv-hook-dev
  3. 须藤宝石安装导轨

回答by humbolight

My mkmf.log showed that gcc (4.8.2 I think) didn't like a specific argument that was being used by atomic on

我的 mkmf.log 显示 gcc(我认为是 4.8.2)不喜欢 atomic on

$ gem install atomic

So I had a very similar situation. The answer for me was to upgrade gcc/gcc-libs and lib tool.

所以我遇到了非常相似的情况。我的答案是升级 gcc/gcc-libs 和 lib 工具。

I use Arch linux, and only Arch linux. The proper way to do this is to run

我使用 Arch linux,并且只使用 Arch linux。正确的方法是运行

$ sudo pacman -Syu

which upgrades all system packages.

升级所有系统包。

I installed Rails and hadn't run a system update since, which is where the issue came from. In most other *nix distros, you would update to the latest version of these packages by name, i.e. with apt, it would be something along the lines of

我安装了 Rails 并且此后没有运行系统更新,这就是问题的来源。在大多数其他 *nix 发行版中,您将按名称更新到这些软件包的最新版本,即使用 apt,这将类似于

$ sudo apt-get update

followed by

其次是

$ sudo apt-get upgrade {package-name}

回答by etusm

For what it's worth, using Ruby 2.0.0 I was having this problem on OSX 10.10.

对于它的价值,使用 Ruby 2.0.0 我在 OSX 10.10 上遇到了这个问题。

I ended up running brew update, which resolved some conflicts, then installed the gem and it was fine.

我最终运行了brew update,它解决了一些冲突,然后安装了 gem,它很好。