无法安装mysql gem / ruby​​-dev

时间:2014-03-31 13:41:13

标签: ruby linux rubygems apt-get

我正在尝试安装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包管理器和依赖项的方式。

1 个答案:

答案 0 :(得分:0)

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