2014-03-31 118 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軟件了。