ROS: Cannot mix incompatible Qt library (version 0x50905) with this library (version 0x50c01)

错误

开始尝试使用rosrun turtlesim turtlesim_node运行ROS的入门样例时,出现这样的错误:Cannot mix incompatible Qt library (version 0x50905) with this library (version 0x50c01) Aborted (core dumped)

根据提示可以判断是QT的版本不兼容导致的错误,百度知道查看当前QT版本:

$ qmake -v
QMake version 2.01a
Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu

发现QT的版本是4.8.x。使用命令qtchooser -l查看:

$ qtchooser -l
4
5
default
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5

电脑中可以看到QT4和QT5是都有的,想着去切换QT的版本到5应该可以,结果没找到很好的方案。

参考了这篇文章:https://answers.ros.org/question/331375/tutrlesim_node-fails-due-to-incompatible-qt-library/,

查看~/.bashrc文件,发现:

# CoppeliaSim
export COPPELIASIM_ROOT=/path_to_coppeliasim/CoppeliaSim_Edu_V4_0_0_Ubuntu18_04
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COPPELIASIM_ROOT
export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT

发现这里面涉及到了QT的部分,将LD_LIBRARY_PATHQT_QPA_PLATFORM_PLUGIN_PATH注释掉,关掉所有的terminal或者source一下,重新运行即可解决原来的问题。

可以看到CoppeliaSim需要的QT的版本是5.12.x

[xxx@xxx:~/Softwares/CoppeliaSim_Edu_V4_0_0_Ubuntu18_04]$ ls | grep Qt5
libQt53DCore.so
libQt53DCore.so.5
libQt53DCore.so.5.12
libQt53DCore.so.5.12.5
libQt53DExtras.so
libQt53DExtras.so.5
libQt53DExtras.so.5.12
libQt53DExtras.so.5.12.5
libQt53DInput.so
libQt53DInput.so.5
libQt53DInput.so.5.12
libQt53DInput.so.5.12.5
libQt53DLogic.so
libQt53DLogic.so.5
libQt53DLogic.so.5.12
libQt53DLogic.so.5.12.5
libQt53DRender.so
libQt53DRender.so.5
libQt53DRender.so.5.12
libQt53DRender.so.5.12.5
libQt5Concurrent.so
libQt5Concurrent.so.5
libQt5Concurrent.so.5.12
libQt5Concurrent.so.5.12.5
libQt5Core.so
libQt5Core.so.5
libQt5Core.so.5.12
libQt5Core.so.5.12.5
libQt5DBus.so
libQt5DBus.so.5
libQt5DBus.so.5.12
libQt5DBus.so.5.12.5
libQt5Gamepad.so
libQt5Gamepad.so.5
libQt5Gamepad.so.5.12
libQt5Gamepad.so.5.12.5
libQt5Gui.so
libQt5Gui.so.5
libQt5Gui.so.5.12
libQt5Gui.so.5.12.5
libQt5Network.so
libQt5Network.so.5
libQt5Network.so.5.12
libQt5Network.so.5.12.5
libQt5OpenGL.so
libQt5OpenGL.so.5
libQt5OpenGL.so.5.12
libQt5OpenGL.so.5.12.5
libQt5PrintSupport.so
libQt5PrintSupport.so.5
libQt5PrintSupport.so.5.12
libQt5PrintSupport.so.5.12.5
libQt5SerialPort.so
libQt5SerialPort.so.5
libQt5SerialPort.so.5.12
libQt5SerialPort.so.5.12.5
libQt5Widgets.so
libQt5Widgets.so.5
libQt5Widgets.so.5.12
libQt5Widgets.so.5.12.5
libQt5XcbQpa.so
libQt5XcbQpa.so.5
libQt5XcbQpa.so.5.12
libQt5XcbQpa.so.5.12.5
libQt5Xml.so
libQt5Xml.so.5
libQt5Xml.so.5.12
libQt5Xml.so.5.12.5

找到系统中的QT的版本5.9.x

[xxx@xxx:/usr/lib/qt5/bin]$ ls
assistant  fixqt4headers.pl  linguist  lupdate  pixeltool             qdbus         qdbusviewer   qdoc            qhelpgenerator  qmake                  qtdiag   qtplugininfo  syncqt.pl
designer   lconvert          lrelease  moc      qcollectiongenerator  qdbuscpp2xml  qdbusxml2cpp  qhelpconverter  qlalr           qtattributionsscanner  qtpaths  rcc           uic

[xxx@xxx:/usr/lib/qt5/bin]$ ./qmake -v
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu

不知道是4.8.x5.12.x的矛盾,还是5.9.x5.12.x的矛盾

你可能感兴趣的:(ROS,ROS,QT,不兼容)