树莓派4B安装libbluetooth-dev报错解决

直接apt-get安装libbluetooth-dev时发生依赖错误:

pi@raspberrypi:~ $ sudo apt-get install libbluetooth-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:
 libbluetooth-dev : Depends: libbluetooth3 (= 5.50-1.2~deb10u1) but 5.50-1.2~deb10u1+rpt1 is to be installed

并且-f和-m都无法绕过这类依赖错误。

实际上从名字猜测,因为5.50-1.2~deb10u1+rpt1和5.50-1.2~deb10u1看似非常接近,可能前者是专为raspberry发布的一个版本,因此我们考虑强行绕过依赖检查。

树莓派上绕过dependency检查的一般套路是:

apt-get下载deb包

使用dpkg --force-depends-version忽略dependency错误。即:

pi@raspberrypi:~ $ apt-get download libbluetooth-dev
pi@raspberrypi:~ $ ll
total 244
drwxr-xr-x 2 pi   pi     4096 May 27 15:18 Bookshelf
drwxr-xr-x 6 pi   pi     4096 Jun 13 20:37 code
drwxr-xr-x 2 pi   pi     4096 Jun 13 20:19 Desktop
drwxr-xr-x 2 pi   pi     4096 May 27 15:46 Documents
drwxr-xr-x 2 pi   pi     4096 Jun 20 22:19 Downloads
-rw-r--r-- 1 root root 190008 Mar 27 18:08 libbluetooth-dev_5.50-1.2~deb10u1_armhf.deb
drwxr-xr-x 2 pi   pi     4096 May 27 15:46 Music
drwxr-xr-x 2 pi   pi     4096 May 27 15:46 Pictures
drwxr-xr-x 2 pi   pi     4096 May 27 15:46 Public
drwxr-xr-x 2 pi   pi     4096 May 27 15:46 Templates
drwxr-xr-x 2 pi   pi     4096 Jun 13 20:14 Videos
pi@raspberrypi:~ $ sudo dpkg -i --force-depends-version ./libbluetooth-dev_5.50-1.2~deb10u1_armhf.deb
(Reading database ... 158172 files and directories currently installed.)
Preparing to unpack .../libbluetooth-dev_5.50-1.2~deb10u1_armhf.deb ...
Unpacking libbluetooth-dev:armhf (5.50-1.2~deb10u1) over (5.50-1.2~deb10u1) ...
dpkg: libbluetooth-dev:armhf: dependency problems, but configuring anyway as you requested:
 libbluetooth-dev:armhf depends on libbluetooth3 (= 5.50-1.2~deb10u1); however:
  Version of libbluetooth3:armhf on system is 5.50-1.2~deb10u1+rpt1.

Setting up libbluetooth-dev:armhf (5.50-1.2~deb10u1) ...

然后检查安装成功:

pi@raspberrypi:~ $ dpkg -l|grep bluetoo
ii  libbluetooth-dev:armhf                5.50-1.2~deb10u1                       armhf        Development files for using the BlueZ Linux Bluetooth library
ii  libbluetooth3:armhf                   5.50-1.2~deb10u1+rpt1                  armhf        Library to use the BlueZ Linux Bluetooth stack
ii  lxplug-bluetooth                      0.13                                   armhf        Bluetooth plugin for lxpanel
ii  pi-bluetooth                          0.1.13                                 all          Raspberry Pi 3 bluetooth

pi@raspberrypi:~ $ find /usr/ -name "bluetooth.h"
/usr/include/bluetooth/bluetooth.h

猜你喜欢

转载自www.cnblogs.com/shijianyujingshen/p/13196586.html