ubuntu 12.04 libudev-dev因为依赖而无法安装

前端之家收集整理的这篇文章主要介绍了ubuntu 12.04 libudev-dev因为依赖而无法安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一些示例c代码,使用udev库接收hotplug事件.它在Ubuntu 10.04中运行良好.它的唯一先决条件是libudev-dev包:
sudo apt-get install libudev-dev

但是当我尝试在12.04安装该软件包时,我得到:

sudo apt-get install libudev-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:
libudev-dev : Depends: libudev0 (= 175-0ubuntu9) but 175-0ubuntu9.3 is to be installed
E: Unable to correct problems,you have held broken packages.

这似乎意味着我应该安装libudev0,所以:

sudo apt-get install libudev0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libudev0 is already the newest version.
0 upgraded,0 newly installed,0 to remove and 0 not upgraded.

我不知道怎么从这里开始. libudev-dev依赖于libudev0,但已经存在,所以……下一步是什么?

请注意,sources.list中未注释以下repos,我已完成apt-get更新:

deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted    
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe

有些网站表示我应该做-f:

sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded,0 to remove and 0 not upgraded.

找到了一个很好的链接
https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies
但没有快乐.

谷歌说这对其他人来说是一个扣篮……

感谢您的帮助,
约翰

这是解决方案.

当您阅读以下内容时:

The following packages have unmet dependencies:
libudev-dev : Depends: libudev0 (= 175-0ubuntu9) but 175-0ubuntu9.3 is to be installed
E: Unable to correct problems,you have held broken packages.

这意味着我尝试安装的libudev-dev包取决于包:

libudev0 version 175-0ubuntu9

(这就是“(= 175-0ubuntu9)”试图说的)

但已经安装了libudev0版本175-0ubuntu9.3.

(这就是“但是要安装175-0ubuntu9.3”试图说).

换句话说:

>已安装较新版本的libudev0.
>我尝试安装的libudev-dev软件包取决于较早版本的libudev0,它已经安装.
>这反过来意味着我安装libudev-dev的存储库已经过时了.

您可以在/etc/apt/sources.list中列出的所有存储库中找到可用的软件包:

sudo apt-cache madison libudev-dev
sudo apt-cache madison libudev0

所以最后我们得到了真正的问题!我在sources.list中的存储库列表缺少包含libudev-dev 175-0ubuntu9.3的存储库.

解决这个问题:

>转到http://packages.ubuntu.com搜索“libudev-dev”
>在结果列表中找到175-0ubuntu9.3 for Precise Pangolin(ubuntu 12.04).在这种情况下,该版本在“exact-udpates”下.您可以点击链接

http://packages.ubuntu.com/precise-updates/libudev-dev

显示了您想要了解的有关libudev-dev的所有信息.除了它没有显示我应该使用的确切回购网址!所以我要稍微猜一下……
>添加repos到apt

sudo gedit /etc/apt/sources.list
[ add these two repos ]
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main    
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main

>刷新

sudo apt-get update
sudo apt-cache madison libudev-dev
[you should see libudev-dev 175-0ubuntu9.3 in the output]
libudev-dev | 175-0ubuntu9.3 | http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages

>安装包:

sudo apt-get install libudev-dev

这就像一个魅力!

约翰

猜你在找的Ubuntu相关文章