sudo apt-get install build-essential git cmake flex bison libelf-dev libusb-dev libhidapi-dev libftdi1-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.9ubuntu3).
build-essential set to manually installed.
git is already the newest version (1:2.34.1-1ubuntu1.4).
git set to manually installed.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
bison : Depends: m4
cmake : Depends: libjsoncpp25 (>= 1.9.5) but it is not going to be installed
Depends: librhash0 (>= 1.2.6) but it is not going to be installed
Depends: cmake-data (= 3.22.1-1ubuntu1.22.04.1) but it is not going to be installed
flex : Depends: m4
Recommends: libfl-dev but it is not going to be installed
libfaudio0 : Depends: libsdl2-2.0-0 (>= 2.0.16) but it is not going to be installed
libftdi1-dev : Depends: libusb-1.0-0-dev but it is not going to be installed
Recommends: libftdi1-doc but it is not going to be installed
libhidapi-dev : Depends: libhidapi-libusb0 (= 0.11.2-1) but it is not going to be installed
Depends: libhidapi-hidraw0 (= 0.11.2-1) but it is not going to be installed
libusb-dev : Depends: libusb-0.1-4 (= 2:0.1.12-32build3) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
答案1
该错误通常发生在您从第三方存储库(例如 Ubuntu PPA)安装了软件包之后。然后,您删除了该 PPA。但是,您要安装的软件包需要您从该 PPA 安装的软件包的另一个版本。
重点是找出which package
或which PPA
导致冲突的原因。然后,安装该软件包的正确版本(例如使用 Synaptic 包管理器),或者重新添加 PPA 并清除它,这会将所有已安装的软件包降级为原始版本:
sudo apt install ppa-purge && sudo ppa-purge ppa:maintainer-id/ppa-name
在这种情况下,我会首先尝试输出中提到的命令:sudo apt --fix-broken install
,或者使用sudo aptitude install build-essential git cmake flex bison ...
来看看它是否有帮助。
或者,使用 apt 命令尝试安装您提供的输出中的每个包:
sudo apt install libjsoncpp25
sudo apt install cmake-data
sudo apt install libsdl2-2.0-0
...
...
直到它告诉我类似的内容:Depends: key-package (=x.x.x) but anther version (x.x.x) is already installed.
最后通过下面的命令或 Synaptic 包管理器切换密钥包版本:
sudo apt install key-package=x.x.x