2014-03-31 119 views
1

我正在尝试安装ruby mysql gem。 gem install mysql后,我得到:无法安装MySQL gem/ruby​​-dev

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包管理器和依赖关系的方式。

+0

您是否安装了构建要领? – AndreDurao

+0

是的,我已经安装了必要的软件包。 –

+0

我是一样的情况。你在某些方面解决了吗? – ilpaijin

回答

0

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