Ask Your Question

Qt5Widgets cmake error

asked 2017-01-16 04:36:04 -0500

pallavbakshi gravatar image

updated 2017-01-17 06:16:18 -0500


While building a catkin workspace I need to perform the following steps:

$ source /opt/ros/indigo/setup.bash
$ cd ~/overlay_ws/
$ catkin_make

as mentioned on catkin tutorial step 2.3 Following the last step induced an error:

 By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:


  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.

So to fix that I installed Qt5 from the website. Now I had to manually change the CMAKE_PREFIX_PATH using CMAKE_PREFIX_PATH="$ENV{HOME}\qt5\5.5\gcc_64" to include qt5.

And then I tried again which gave me another error:

CMake Error at /opt/ros/indigo/share/genmsg/cmake/genmsg-extras.cmake:271 (message):
  Could not find 'share/std_msgs/cmake/std_msgs-msg-paths.cmake' (searched in
Call Stack (most recent call first):
  ros_tutorials/roscpp_tutorials/CMakeLists.txt:11 (generate_messages)

to solve the above error, a forum recommended me to do the source command again

 $ source /opt/ros/indigo/setup.bash

Performing the source command again removes the path variable again. Now I am stuck in a loop.

Operating System Details As mentioned in comments, it might be useful for the community to answer based on the operating system I am using as well as the particular installation process I adopted to install ROS. Current OS - Ubuntu 14.04 ROS - indigo Installation guide followed to install indigo -

Can someone tell me how to change environment path variable properly? Example - how to change CMAKE_PREFIX_PATH in this case?

Kindly help.

edit retag flag offensive close merge delete


Checking the Qt Cmake Manual suggests to:

In order for find_package to be successful, ... the Qt5<module>_DIR must be set in the CMake cache to the location of the Qt5WidgetsConfig.cmake file.

Have you tried this? I have no setup, so I cannot...

mgruhler gravatar image mgruhler  ( 2017-01-17 00:47:45 -0500 )edit

While building a catkin workspace

Could you please tell us what package(s) you are trying to build? The last time I've had to manually install Qt on an Ubuntu system has been very long ago, so only in specific circumstances should that be necessary.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 01:30:54 -0500 )edit

@gvdhoorn - I am trying to build which is basically the ros_tutorials package. I am following the steps from the website: and the step 2.2 instructs me to clone from git and build it in step 2.3

pallavbakshi gravatar image pallavbakshi  ( 2017-01-17 03:26:56 -0500 )edit

Qt5 is correctly listed as a dependency of turtlesim (the pkg that needs it in ros_tutorials). Can you please tell us what OS you are trying this on, how you installed ROS, which version it is, etc?

The tutorial doesn't explicitly mention it, but without the necessary prereqs, it won't work.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 03:37:46 -0500 )edit

However, the sudo apt-get install ros-kinetic-ros-tutorials in step 1.1 (Preparing the environment) should already have installed all the necessary dependencies, hence my questions about your specific setup.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 03:38:37 -0500 )edit

Note that the tutorial does it this way as it is a tutorial on workspace overlaying, not on general Catkin workspace usage or creation. When overlaying, either all dependencies have already been satisfied, or you are responsible for making sure they are installed.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 03:42:11 -0500 )edit

Another thing:


the path separator on Linux/Unix/MacOS(X) is the forward slash (/), not a backslash (\). The backslash is an escape character, so your CMAKE_PREFIX_PATH does not work this way.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 03:45:02 -0500 )edit

Just realised (but can't test it right now) that it might be that apt-get only installed the runtime requirements. If, after installing ros-kinetic-ros-tutorials (and without the CMAKE_PREFIX_PATH tweak) you still get errors, can you run a ..

gvdhoorn gravatar image gvdhoorn  ( 2017-01-17 04:15:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-23 06:55:06 -0500

gvdhoorn gravatar image

updated 2017-01-23 08:28:49 -0500

You are probably trying to build the Kinetic version of ros_tutorials on your Indigo installation. Kinetic uses Qt5, Indigo uses Qt4.

Check that you have indigo-devel as the current branch in /home/pb/ROS01/overlay_ws/src/ros_tutorials, and not kinetic-devel. If the wrong branch is checked out, change to indigo-devel, delete the build and devel folders in /home/pb/ROS01/overlay_ws, undo the CMAKE_PREFIX_PATH changes that you made (ideally remove the Qt version you installed using the installer from the website) and try building again.

edit flag offensive delete link more


Do you have any experience with KinectV2 SLAM with gmapping. I am stuck at pointcloud_to_laserscanner part. Do I need to install any other driver (apart from libfreenect2).

pallavbakshi gravatar image pallavbakshi  ( 2017-01-23 08:11:27 -0500 )edit

That is a completely unrelated issue, and I would suggest you open a new question to keep things on-topic.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-23 08:28:30 -0500 )edit

Hey! How can I check if I have the right branch or not. In my case it doesn't mention any branch. It has 4 folder there - roscpp_tutorials, rospy_tutorials, ros_tutorials & turtlesim

pallavbakshi gravatar image pallavbakshi  ( 2017-01-24 04:43:47 -0500 )edit

cd to your local clone, then run git status. It should tell you what branch you're on. If you want a list of all branches, you could use git branch -av.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-24 04:52:38 -0500 )edit

What worked for me! - using git clone --version indigo-devel git:// rather than using the wstool command mentioned on the same page. How can I use the --version option with wstool however?

pallavbakshi gravatar image pallavbakshi  ( 2017-01-24 05:01:54 -0500 )edit

These are all new questions, only tangentially related to your original issue. Please open a new question for them.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-24 05:18:55 -0500 )edit

Here we go with a new question:

pallavbakshi gravatar image pallavbakshi  ( 2017-01-24 07:53:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-01-16 04:36:04 -0500

Seen: 1,480 times

Last updated: Jan 23 '17