【问题标题】:Cannot install mysql gem / ruby-dev无法安装 mysql gem / ruby​​-dev
【发布时间】:2014-03-31 13:41:12
【问题描述】:

我正在尝试安装 ruby​​ mysql gem。在gem install mysql 之后我得到:

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

    /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/mysql-2.9.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

我发现this answer 建议安装ruby-dev,但在apt-get install ruby1.9.1-devapt-get install ruby-dev 之后我得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
ruby1.9.1-dev : Depends: libruby1.9.1 (= 1.9.3.194-8.1ubuntu2) but 1.9.3.194-8.1ubuntu2.1 is to be installed
                Recommends: ruby1.9.1 (= 1.9.3.194-8.1ubuntu2) but 1.9.3.194-8.1ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.

1) 我该如何解决这个问题?

2) 更有趣的是:由于问题发生在全新的 xubuntu 安装中,是什么导致了这种类型的错误?我是否设法在不知不觉中破坏了某些东西?我会很感激一个资源链接,它将帮助我了解 Linux 下 Ubuntu 包管理器和依赖项的方式。

【问题讨论】:

  • 您是否安装了构建必需品?
  • 是的,我已经安装了 build-essential 包。
  • 我也是这种情况。你在某些方面解决了吗?
  • @ilpaijin,不 - 我使用了不同版本的 Ruby 和 gem,但尽管尝试了多次,但我无法让它工作。

标签: ruby linux rubygems apt-get


【解决方案1】:

我在 Ubuntu 14.04 上遇到了同样的问题。我删除了所有 ruby​​ 、ruby-1.9 、ruby-dev 包并重新安装 ruby​​ 和 ruby​​-dev。看来我现在可以通过 gem 安装 ruby​​ 软件了。

【讨论】:

    猜你喜欢
    • 2021-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-02
    • 2011-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多