Ubuntu18.04 + ROS melodic 安装google-cartographer,
Compiling Cartographer ROS — Cartographer ROS documentation
出现下面的报错,
$ catkin_make_isolated --install --use-ninja
... CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:27 (message): The imported target "Qt5::Gui" references the file "/usr/lib/x86_64-linux-gnu/libEGL.so" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake" but not all the files it references. Call Stack (most recent call first): /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:50 (_qt5_Gui_check_file_exists) /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:72 (_qt5gui_find_extra_libs) /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:184 (include) /usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:101 (find_package) /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package) CMakeLists.txt:56 (find_package) -- Configuring incomplete, errors occurred! See also ...
解决办法:
先查看一下libegl到底怎么回事
~/projects/cartographer$ ls /usr/lib/x86_64-linux-gnu | grep -i libegl libEGL_mesa.so.0 libEGL_mesa.so.0.0.0 libEGL_nvidia.so.0 libEGL_nvidia.so.470.82.01 libEGL.so libEGL.so.1 libEGL.so.1.1.0
然后查检一下这个libEGL.so为什么找不到
~/projects/cartographer$ ls -l /usr/lib/x86_64-linux-gnu/libEGL.so lrwxrwxrwx 1 root root 15 5月 10 2019 /usr/lib/x86_64-linux-gnu/libEGL.so -> libEGL.so.1.0.0 ~/projects/cartographer$ ls -l /usr/lib/x86_64-linux-gnu/libEGL.so.1 lrwxrwxrwx 1 root root 15 2月 22 08:34 /usr/lib/x86_64-linux-gnu/libEGL.so.1 -> libEGL.so.1.1.0
这样,发现libEGL.so链接的是libEGL.so.1.0.0,而实际这里只有libEGL.so.1.1.0,不存在libEGL.so.1.0.0;当然你也可以找到libEGL.so这个文件,右击属性就会发现这个文件显示的是
链接(已断) (inode/symlink),或Link (broken) (inode/symlink)
原因就是链接已经断掉了,我们把它重新链接上(顺便再检查一下)就好了,
~/projects/cartographer$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libEGL.so.1.1.0 /usr/lib/x86_64-linux-gnu/libEGL.so ~/projects/cartographer$ ls -l /usr/lib/x86_64-linux-gnu/libEGL.so lrwxrwxrwx 1 root root 41 2月 27 15:37 /usr/lib/x86_64-linux-gnu/libEGL.so -> /usr/lib/x86_64-linux-gnu/libEGL.so.1.1.0
当然,为了避免弄错,你也可以先备份后再进行上速的强行替换操作。
先备份再 sudo rm /usr/lib/x86_64-linux-gnu/libEGL.so 然后再 sudo ln -sf /usr/lib/x86_64-linux-gnu/libEGL.so.1.1.0 /usr/lib/x86_64-linux-gnu/libEGL.so
--------------------------------------------
对于出现的另一个同样的报错,
... CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:27 (message): The imported target "Qt5::Gui" references the file "/usr/lib/x86_64-linux-gnu/libGL.so" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake" but not all the files it references. Call Stack (most recent call first): /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:50 (_qt5_Gui_check_file_exists) /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:74 (_qt5gui_find_extra_libs) /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:184 (include) /usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:101 (find_package) /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package) CMakeLists.txt:56 (find_package) -- Configuring incomplete, errors occurred! See also ...
采取类似的手段就可以了,
~/projects/cartographer$ ls /usr/lib/x86_64-linux-gnu | grep -i libgl libgl2ps.so libgl2ps.so.1.4 libgl2ps.so.1.4.0 libglade libglade-2.0.so.0 libglade-2.0.so.0.0.7 libglapi.so.0 libglapi.so.0.0.0 libGLdispatch.so libGLdispatch.so.0 libGLESv1_CM_nvidia.so.1 libGLESv1_CM_nvidia.so.470.82.01 libGLESv1_CM.so libGLESv1_CM.so.1 libGLESv1_CM.so.1.0.0 libGLESv1_CM.so.1.2.0 libGLESv2_nvidia.so.2 libGLESv2_nvidia.so.470.82.01 libGLESv2.so libGLESv2.so.2 libGLESv2.so.2.1.0 libglib-2.0.a libglib-2.0.so libglib-2.0.so.0 libglib-2.0.so.0.5600.4 libglog.a libglog.so libglog.so.0 libglog.so.0.0.0 libGL.so libGL.so.1 libGL.so.1.7.0 libGLU.a libGLU.so libGLU.so.1 libGLU.so.1.3.1 libglut.a libglut.so libglut.so.3 libglut.so.3.9.0 libGLX_indirect.so.0 libGLX_mesa.so.0 libGLX_mesa.so.0.0.0 libGLX_nvidia.so.0 libGLX_nvidia.so.470.82.01 libGLX.so libGLX.so.0
然后,
~/projects/cartographer$ ls -l /usr/lib/x86_64-linux-gnu/libGL.so lrwxrwxrwx 1 root root 14 5月 10 2019 /usr/lib/x86_64-linux-gnu/libGL.so -> libGL.so.1.0.0 ~/projects/cartographer$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0 /usr/lib/x86_64-linux-gnu/libGL.so ~/projects/cartographer$ ls -l /usr/lib/x86_64-linux-gnu/libGL.so lrwxrwxrwx 1 root root 40 2月 27 15:40 /usr/lib/x86_64-linux-gnu/libGL.so -> /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0
本文结束。