一.问题描述
解决:sudo apt-get install libffi-dev无法安装,路上遇到的坑.
joes@joes:~$ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libasound2 : Depends: libasound2-data (>= 1.1.3-5) but 1.1.0-0ubuntu1 is to be installed
libasound2-dev : Depends: libasound2 (= 1.1.0-0ubuntu1)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
二.首先安装libffi-dev包故障,执行sudo apt-get -f install也无法进行自动修复,提示依赖包错误.仔细查看报警信息,发现libasound2-data (>= 1.1.3-5) but 1.1.0-0ubuntu1 is to be installed误.
1.原因就是当前的 libasound2-data 版本是1.1.0-0ubuntu1,非要求的>= 1.1.3-5版本,所以为网上搜索到>= 1.1.3-5的libasound2-data包.
https://ubuntu.pkgs.org/18.04/ubuntu-main-amd64/libasound2-data_1.1.3-5_all.deb.html
2.下载后,执行:
joes@joes:~/Downloads$ sudo dpkg -i libasound2-data_1.1.3-5_all.deb
3.安装完 libasound2-data 依赖包后,再次执行:
sudo apt-get -f install
可以自动修复了.
4.最后执行:
sudo apt-get install libffi-dev
安装成功.
如遇到其他的依赖包问题,可举一反三,下载到适当的版本包,安装即可.