ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
836 stars 464 forks source link

Cannot mix incompatible Qt versions #1431

Closed eugval closed 5 years ago

eugval commented 5 years ago

Following the installation instructions form here , I installed rviz and run

rosrun rviz rviz

And I get the following output: image

It seems that I need to upgrate Qt to version 5.13 from 5.95, but even after following the instructions from here:

the result is the same and when I run rviz the output is the same.

I am quite new to ROS and Rviz, any help in how to fix this would be much appreciated!

I am running the following:

rhaschke commented 5 years ago

When you installed rviz from binary packages (via sudo apt-get install ros-melodic-rviz), this rviz version is bound to the default Qt version shipped with Ubuntu (which is 5.9.5). If you want to use your private Qt version, you need to build rviz from source. But actually, I don't recommend this, if you didn't manage the above.

eugval commented 5 years ago

Thanks!

Any ideas why it gave me the incompatible Qt library error message then when I just installed through apt or how could I fix it?

I thought because it was expecting a later version of Qt than the Ubuntu default so I installed 5.13.1, but as you say this was not the issue?

rhaschke commented 5 years ago

Probably you had another Qt version installed in your system and included via LD_LIBRARY_PATH. On a clean Ubuntu installation, you won't observe such issues.

eugval commented 5 years ago

Fantastic! That was it, thank you.

For reference : VRep seemed to be the issue. When I cleared the LD_LIBRARY_PATH of the path to v-rep, it started working, so it probably uses its own version of Qt, and points to it via LD_LIBRARY_PATH.

yquantao commented 3 years ago

Fantastic! That was it, thank you.

For reference : VRep seemed to be the issue. When I cleared the LD_LIBRARY_PATH of the path to v-rep, it started working, so it probably uses its own version of Qt, and points to it via LD_LIBRARY_PATH.

I met the same problem, how did you clear the LD_LIBRARY_PATH? I commented out it in .bashrc, but it does not work.

rhaschke commented 3 years ago

When you updated .bashrc, you need to create a new terminal first to get the updated environment.

RahulraaghavA1308 commented 2 years ago

Fantastic! That was it, thank you.

For reference : VRep seemed to be the issue. When I cleared the LD_LIBRARY_PATH of the path to v-rep, it started working, so it probably uses its own version of Qt, and points to it via LD_LIBRARY_PATH.

Yeah Thank you so much. this worked for me. I commented those lines in the .bashrc file and the issue was solve

lgzid commented 1 year ago

@yquantao how can i use vrep and rviz together

rhaschke commented 1 year ago

@lgzid, simply don't set a default LD_LIBRARY_PATH (aiming for a one-fits-all configuration, which doesn't work) but configure it depending on the application(s) to start. Sourcing ROS' setup.bash files automatically configures (actually augments) the LD_LIBRARY_PATH with all stuff required for ROS. If you have a similar script for VREP your done.

lgzid commented 1 year ago

@rhaschke Thank you for your reply! May I ask if there is a similar tutorial to modify? I am not sure about the specific operation This is my .bashrc file: export COPPELIASIM_ROOT=/home/***/software/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COPPELIASIM_ROOT export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT

rhaschke commented 1 year ago

You should remove the LD_LIBRARY_PATH setting from your .bashrc. Just keep:

export COPPELIASIM_ROOT=/home/***/software/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04
export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT

Create a separate script vrep.sh comprising: LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$COPPELIASIM_ROOT" vrep

lgzid commented 1 year ago

@rhaschke Thank you for your reply! Actually, I need to use rviz, vrep, and pyrep to complete my work.

I found the problem in the third line:

export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT

When I cleared it, rviz and vrep worked normally.But the pyrep doesn't work because it can't find the path to QT.

I just tried your approach, but it still hasn't worked. This is my modified file: .bashrc:

export COPPELIASIM_ROOT=/home/***/software/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04
export QT_QPA_PLATFORM_PLUGIN_PATH=$COPPELIASIM_ROOT

coppeliasim.sh:

# LD_LIBRARY_PATH=$dirname:$LD_LIBRARY_PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COPPELIASIM_ROOT
export LD_LIBRARY_PATH
rhaschke commented 1 year ago

Then just set the QT_QPA_PLATFORM_PLUGIN_PATH variable just for pyrep in a similar fashion as described above. Please stop spamming this thread, but ask the pyrep community for further help.