melodic版本-moveit源码安装遇到问题及解决

前言

最近在研究ROS moveit的源码,于是使用源码安装,方便调试,于是按照官网进行编译安装,不过编译安装遇到一个奇葩的问题,现把解决方法和问题罗列出来,这里严格来说不是moveit的问题,是我关于Qt5编译环境的问题。

编译报错如下:

Errors     << moveit_visual_tools:make /data/ros/code/ws_moveit/logs/moveit_visual_tools/build.make.001.log                                       
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QBitmap::fromImage(QImage&&, QFlags)@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QWindowPrivate::setVisible(bool)@Qt_5_PRIVATE_API'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QColor::lighter(int) const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QMessageDialogOptions::customButton(int)@Qt_5_PRIVATE_API'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QGuiApplication::screenAt(QPoint const&)@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QMessageDialogOptions::addButton(QString const&, QPlatformDialogHelper::ButtonRole, void*)@Qt_5_PRIVATE_API'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QStyleHints::showShortcutsInContextMenus() const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QTest::qWaitForWindowExposed(QWindow*, int)@Qt_5'
//usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: undefined reference to `QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, QFlags) const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QWindow::setWindowStates(QFlags)@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QPlatformSystemTrayIcon::contextMenuRequested(QPoint, QPlatformScreen const*)@Qt_5_PRIVATE_API'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QFontMetrics::horizontalAdvance(QString const&, int) const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QColor::darker(int) const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QWindow::windowStates() const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QImage::sizeInBytes() const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QFontMetrics::horizontalAdvance(QChar) const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QTest::qWaitForWindowActive(QWindow*, int)@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QGuiApplicationPrivate::sendApplicationPaletteChange(bool, char const*)@Qt_5_PRIVATE_API'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QStyleHints::mouseQuickSelectionThreshold() const@Qt_5'
//usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: undefined reference to `QLocaleData::bytearrayToLongLong(char const*, int, bool*, bool*)@Qt_5'
collect2: error: ld returned 1 exit status
make[2]: *** [/data/ros/code/ws_moveit/devel/.private/moveit_visual_tools/lib/moveit_visual_tools/moveit_visual_tools_demo] Error 1
make[1]: *** [CMakeFiles/moveit_visual_tools_demo.dir/all] Error 2
make: *** [all] Error 2
cd /data/ros/code/ws_moveit/build/moveit_visual_tools; catkin build --get-env moveit_visual_tools | catkin env -si  /usr/bin/make --jobserver-fds=8,9 -j; cd -

解决方案:

观察报错,一般这种报错,要不是没安装QT要不就是环境变量不对,它自己没找到造成报错。
于是我直接在我环境变量里加入如下:
看自己的QT环境所在。

vim ~/.bashrc
export PATH=/opt/Qt5.13.0/5.13.0/gcc_64/bin:$PATH
export LD_LIBRARY_PATH=/opt/Qt5.13.0/5.13.0/gcc_64/lib:$LD_LIBRARY_PATH

编译解决

catkin build
[build] Summary: All 27 packages succeeded!                                                                                                       
[build]   Ignored:   5 packages were skipped or are blacklisted.                                                                                  
[build]   Warnings:  1 packages succeeded with warnings. 

你可能感兴趣的:(Ros)