目錄
坑(2)顯示缺少 libreadline6-dev, 於是又用命令
在ubuntu16.0.4上安裝lua 5.3.5,運行命令
make linux
報錯
lua.c:82:31: fatal error: readline/readline.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'lua.o' failed
make[2]: *** [lua.o] Error 1
make[2]: Leaving directory '/usr/local/lua/lua-5.3.5/src'
Makefile:110: recipe for target 'linux' failed
make[1]: *** [linux] Error 2
make[1]: Leaving directory '/usr/local/lua/lua-5.3.5/src'
Makefile:55: recipe for target 'linux' failed
make: *** [linux] Error 2
原因是缺少libreadline-dev依賴包,造成找不到readline.h。
坑(一)添加libreadline-dev 包
sudo apt-get install libreadline-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:
libreadline-dev : Depends: libreadline6-dev (= 6.3-8ubuntu2) but it is not going to be installed
libsmbclient : Depends: samba-libs (= 2:4.3.11+dfsg-0ubuntu0.16.04.21) but 2:4.3.11+dfsg-0ubuntu0.16.04.15 is to be installed
samba-libs : Depends: libwbclient0 (= 2:4.3.11+dfsg-0ubuntu0.16.04.15) but 2:4.3.11+dfsg-0ubuntu0.16.04.21 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
坑(2)顯示缺少 libreadline6-dev, 於是又用命令
sudo apt-get install libreadline6-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:
libreadline6-dev : Depends: libtinfo-dev but it is not going to be installed
libsmbclient : Depends: samba-libs (= 2:4.3.11+dfsg-0ubuntu0.16.04.21) but 2:4.3.11+dfsg-0ubuntu0.16.04.15 is to be installed
samba-libs : Depends: libwbclient0 (= 2:4.3.11+dfsg-0ubuntu0.16.04.15) but 2:4.3.11+dfsg-0ubuntu0.16.04.21 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
坑(3)
sudo apt-get install libtinfo-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:
libsmbclient : Depends: samba-libs (= 2:4.3.11+dfsg-0ubuntu0.16.04.21) but 2:4.3.11+dfsg-0ubuntu0.16.04.15 is to be installed
samba-libs : Depends: libwbclient0 (= 2:4.3.11+dfsg-0ubuntu0.16.04.15) but 2:4.3.11+dfsg-0ubuntu0.16.04.21 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
捅了馬蜂窩了! 再 apt-get install libtinfo-dev 和 samba-libs 的時候出錯了, 不然這遞歸還不知道要添加到哪一步呢。
解決辦法:
查了一些網站,建議清理一下軟件,因爲有些可能是軟件32位和64位不配套的問題或者軟件已損壞
sudo apt-get autoclean
apt-get autoclean可以刪除一些不可用的、過期的、錯誤安裝、損壞的軟件。(清理之後還是編譯不通過,還沒完)
重新安裝 libreadline-dev
sudo apt-get install libreadline-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:
libreadline-dev : Depends: libreadline6-dev (= 6.3-8ubuntu2) but it is not going to be installed
libsmbclient : Depends: samba-libs (= 2:4.3.11+dfsg-0ubuntu0.16.04.21) but 2:4.3.11+dfsg-0ubuntu0.16.04.15 is to be installed
samba-libs : Depends: libwbclient0 (= 2:4.3.11+dfsg-0ubuntu0.16.04.15) but 2:4.3.11+dfsg-0ubuntu0.16.04.21 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
這次不再往下找依賴了,直接用命令
sudo apt-get -f install
The -f
here stands for “fix broken”. Apt
will attempt to correct broken dependencies. If you manually installed a package that had unmet dependencies, apt-get
will install those dependencies, if possible, otherwise it may simply remove the package that you installed in order to resolve the problem.
翻譯一下:
-f 的意思是 fix broken (清理損壞)。 apt會嘗試修改壞的依賴。如果你手動安裝了一個包找不到依賴,apt-get會安裝這些依賴;如果不成功,它會刪除你搬運安裝的包以便解決這個問題。
然後經過一陣子的刷屏,它就自動安裝成功了
root@desktop01:/usr/local/lua/lua-5.3.5# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.13.0-36 linux-headers-4.13.0-36-generic
linux-headers-4.13.0-45 linux-headers-4.13.0-45-generic
linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic
linux-headers-4.15.0-30 linux-headers-4.15.0-30-generic
linux-image-4.13.0-36-generic linux-image-4.13.0-45-generic
linux-image-4.15.0-29-generic linux-image-4.15.0-30-generic
linux-image-extra-4.13.0-36-generic linux-image-extra-4.13.0-45-generic
linux-modules-4.15.0-29-generic linux-modules-4.15.0-30-generic
linux-modules-extra-4.15.0-33-generic
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
samba-libs
The following packages will be upgraded:
samba-libs
1 upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
277 not fully installed or removed.
Need to get 5,170 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 samba-libs amd64 2:4.3.11+dfsg-0ubuntu0.16.04.21 [5,170 kB]
。。。
Setting up libreoffice-writer (1:5.1.6~rc2-0ubuntu1~xenial6) ...
Setting up python3-uno (1:5.1.6~rc2-0ubuntu1~xenial6) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for initramfs-tools (0.122ubuntu8.14) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-33-generic
Processing triggers for linux-image-4.15.0-54-generic (4.15.0-54.58~16.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-54-generic
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.15.0-54-generic
Found initrd image: /boot/initrd.img-4.15.0-54-generic
Found linux image: /boot/vmlinuz-4.15.0-33-generic
Found initrd image: /boot/initrd.img-4.15.0-33-generic
Found linux image: /boot/vmlinuz-4.15.0-32-generic
Found initrd image: /boot/initrd.img-4.15.0-32-generic
Found linux image: /boot/vmlinuz-4.15.0-30-generic
Found initrd image: /boot/initrd.img-4.15.0-30-generic
Found linux image: /boot/vmlinuz-4.15.0-29-generic
Found initrd image: /boot/initrd.img-4.15.0-29-generic
Found linux image: /boot/vmlinuz-4.13.0-45-generic
Found initrd image: /boot/initrd.img-4.13.0-45-generic
Found linux image: /boot/vmlinuz-4.13.0-36-generic
Found initrd image: /boot/initrd.img-4.13.0-36-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
root@desktop01:/usr/local/lua/lua-5.3.5#
後面的事情就簡單了,再編譯一次就好。
看來,linux保持軟件的常換常新才行。
參考:
https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa