执行ROS安装命令:
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
出现错误:
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:
ros-melodic-desktop-full : Depends: ros-melodic-desktop but it is not going to be installed
Depends: ros-melodic-perception but it is not going to be installed
Depends: ros-melodic-simulators but it is not going to be installed
Depends: ros-melodic-urdf-sim-tutorial but it is not going to be installed
顺序执行安装依赖:
sudo apt-get install ros-melodic-desktop
提示:
The following packages have unmet dependencies:
ros-melodic-desktop : Depends: ros-melodic-urdf-tutorial but it is not going to be installed
Depends: ros-melodic-visualization-tutorials but it is not going to be installed
Depends: ros-melodic-viz but it is not going to be installed
继续安装依赖:
sudo apt-get install ros-melodic-urdf-tutorial
系统提示:
The following packages have unmet dependencies:
ros-melodic-urdf-tutorial : Depends: ros-melodic-rviz but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
接续安装依赖:
apt-get install ros-melodic-rviz
系统提示:
The following packages have unmet dependencies:
ros-melodic-rviz : Depends: libgl1-mesa-dev but it is not going to be installed
Depends: libglu1-mesa-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
继续安装依赖:
apt-get install libgl1-mesa-dev
系统提示:
he following packages have unmet dependencies:
libgl1-mesa-dev : Depends: mesa-common-dev (= 20.0.8-0ubuntu1~18.04.1) but it is not going to be installed
Depends: libdrm-dev (>= 2.4.95) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
继续安装依赖:
apt-get install mesa-common-dev
系统提示:
The following packages have unmet dependencies:
mesa-common-dev : Depends: libdrm-dev (>= 2.4.95) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
继续安装依赖库:
apt-get install libdrm-dev
系统提示如下信息,这里的信息就是非常关键了,ROS需要的是libdrm2 (= 2.4.101-2~18.04.1),但是由于firefly定制的系统修改了库的版本 2.4.101-2~18.04.1firefly1。所以导致整个ROS以来出现问题。
The following packages have unmet dependencies:
libdrm-dev : Depends: libdrm2 (= 2.4.101-2~18.04.1) but 2.4.101-2~18.04.1firefly1 is to be installed
解决方法:其实通过这里我们可以分析知道导致ROS不能被安装的本质原因是部分标准的依赖库被修改了名字,所以我们要把这些库修改回原版。下面只是其中一种方法,核心思想就是利用aptitude自动解决依赖的特性把修改后的库版本改为原来的。
# 思路1
aptitude remove libdrm2
# 思路2: 应该是可以,现在不容易复现问题了,核心思想就是让aptitude更换正确的libdrm2版本
aptitude install libdrm-dev
这里,aptitude给出了一个位置不变的方案,被我拒绝了,然后aptitude给出了更换libdrm2 [2.4.101-2~18.04.1firefly1 (now) -> 2.4.101-2~18.04.1 (bionic-updates)]的方案。
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libdrm2 [2.4.101-2~18.04.1firefly1 (now)]
Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:
Remove the following packages:
1) libdrm-tests [2.4.101-2~18.04.1firefly1 (now)]
2) libkms1 [2.4.101-2~18.04.1firefly1 (now)]
Install the following packages:
3) libdrm-common [2.4.101-2~18.04.1 (bionic-updates)]
Downgrade the following packages:
4) libdrm2 [2.4.101-2~18.04.1firefly1 (now) -> 2.4.101-2~18.04.1 (bionic-updates)]
Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
libdrm2
总结:按照上述的方法,可以解决ROS的ros-melodic-desktop的依赖问题。另外4个库的方法和上文类似,是QT方面的库被修改了。经过一晚上的处理,最终在FireFly上RK3566-PC安装ROS成功。