问题陈述:
编译pkg包时遇到以下报错:
CMake Error at /opt/ros/melodic/share/catkin/cmake/platform/lsb.cmake:8 (string):
string no output variable specified
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/all.cmake:164 (include)
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:58 (find_package)
解决方法:
出现该问题是由于下载python版本过多,软连接出错,识别不到lsb这个文件。首先,查看目前python默认版本,输入以下命令:
update-alternatives --config python
显示:
有 3 个候选项可用于替换 python (提供 /usr/bin/python)。
选择 路径 优先级 状态
------------------------------------------------------------
0 /usr/bin/python3.6 2 自动模式
* 1 /usr/bin/python2.7 1 手动模式
2 /usr/bin/python3.6 2 手动模式
3 /usr/bin/python3.8 2 手动模式
要维持当前值[*]请按<回车键>,或者键入选择的编号:
如果没有任何显示,输入以下命令导入:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
然后重新选择默认版本。
然后查看lsb文件位置,输入:
lsb_release -a
显示:bash: /usr/bin/lsb_release: /usr/bin/python3: 解释器错误: 没有那个文件或目录。
输入命令重新下载:
sudo apt install --reinstall lsb-release
再次输入lsb_release -a,显示:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
到这里就可以了,重新去编译catkin_make试试。