Robotics StackExchange | Archived questions

Could not find package after building moveit from source

Hi!

I have built MoveIt from source and in ws_moveit workspace.

However, when I include related Moveit header files in another workspace

#include <moveit_visual_tools/moveit_visual_tools.h>

, I met this error

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

     moveit_visual_toolsConfig.cmake
     moveit_visual_tools-config.cmake

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

I have tried find_package(moveit_visual_tools REQUIRED) and <depend>moveit_visual_tools</depend>, but this error didn't disappear.

I think this error is caused by CMAKE_PREFIX_PATH.

Some related questions, such as this, are answered with a sudo apt-get install ros- solution, but I want to build moveit from source for trying to contribute new features.

I'm not sure if I'm on the right point. Could you give me some advice on how to solve this error?

Thanks!

Asked by JohnDoe on 2023-07-15 08:17:58 UTC

Comments

If you close a question, please provide the solution.

Better yet: don't close it, but post your own answer and accept that answer.

Asked by gvdhoorn on 2023-07-17 01:55:15 UTC

Sure @gvdhoorn, could you help me reopen the answer and I post my solution? I don't have enough points.

Asked by JohnDoe on 2023-07-17 02:42:56 UTC

Done.

You probably won't be able to accept your own answer either, but if you let me know when you've done that, I'll accept it for you.

Asked by gvdhoorn on 2023-07-17 03:28:57 UTC

I assume this is also you: ros-planning/moveit#3476?

Cross-posting like this is not very nice.

Asked by gvdhoorn on 2023-07-17 10:15:21 UTC

I'm so sorry I didn't realize that cross-post was not a nice behavior.

I'll be very mindful of such behavior in the future.

Thanks for the reminder and the help from you. I will ensure that this does not happen again.

Asked by JohnDoe on 2023-07-17 19:40:44 UTC

Answers

I added list(APPEND CMAKE_PREFIX_PATH "/home/ws_moveit/devel") before find_package.

The above solution works for me. But so far, I'm still confused about why CMAKE_PREFIX_PATH only contains /opt/ros/noetic and the devel folder path of my current workspace but not /home/ws_moveit/devel.

Please comment below if you know the reason.

Asked by JohnDoe on 2023-07-17 03:40:47 UTC

Comments

Not what you want to hear perhaps, but this should not be needed and is definitely not a solution.

However, when I include related Moveit header files in another workspace

did you source the devel/setup.bash of that other workspace before trying to build your own package?

Failure to do so would be one of the most common causes of the issue you report.

Asked by gvdhoorn on 2023-07-17 07:03:56 UTC