简体   繁体   English

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

[英]Cannot install mysql gem / ruby-dev

I'm trying to install ruby mysql gem. 我正在尝试安装ruby mysql gem。 After gem install mysql I get: 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

I found this answer recommending installing ruby-dev , but after either apt-get install ruby1.9.1-dev or apt-get install ruby-dev I get: 我找到了建议安装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) How can I fix this problem? 1)如何解决此问题?

2) Even more interestingly: as the problem occurs on a fresh xubuntu installation, what causes this type of errors? 2)更有趣的是:由于问题是在全新的xubuntu安装上发生的,导致这种类型错误的原因是什么? Have I managed to break something unknowingly? 我是否在不知不觉中打破了某些东西? I'll appreciate a link to a resource which will help me get some understanding about the ways of the Ubuntu package manager and dependencies under Linux. 我将欣赏指向资源的链接,该链接将帮助我了解Linux下Ubuntu软件包管理器的方式和依赖项。

I meet the same problem on Ubuntu 14.04. 我在Ubuntu 14.04上遇到了同样的问题。 I remove all the ruby ,ruby-1.9 ,ruby-dev package and re-install ruby and ruby-dev. 我删除所有的ruby,ruby-1.9,ruby-dev软件包,然后重新安装ruby和ruby-dev。 It seems that I can install ruby software by gem now. 看来我现在可以通过gem安装ruby软件了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM