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::ImageConversionFlag>)@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<QLocale::NumberOption>) const@Qt_5'
//opt/Qt5.13.0/5.13.0/gcc_64/lib/libQt5Widgets.so.5: undefined reference to `QWindow::setWindowStates(QFlags<Qt::WindowState>)@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. 
發佈了47 篇原創文章 · 獲贊 47 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章