ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to handle cloned packages that have no package.xml or CMake.txt file in ROS workspace.

asked 2023-04-05 22:32:36 -0500

mikevillan gravatar image

Say I git cloned a repo into my src folder within my workspace. I am unable to catkin build it because it does not have a package.xml nor a CMake file. Essentially, I want to write a python script to import and use this cloned package, but it won't be recognized without building it. Is my only solution to create a package.xml and CMake file for the package and then build it? I am using Ubuntu Focal Fossa with a Noetic ROS distro.

edit retag flag offensive close merge delete


Sorry for the comment noise. The comment got long enough that I changed it to an answer.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2023-04-08 09:06:03 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2023-04-05 23:33:52 -0500

GuimingChen gravatar image

You likely need to have CMakeLists.txt and package.xml file to build a package.

src folder only gives you source code. However, a package still needs CMakeLists.txt and package.xml to provide information about things like build or runtime dependencies, required CMake verion, libraries/executables to build, etc... (

Since each package is very specific, I think you would need to write them. You may want to start by adding contents from a basic template provided on the ROS tutorial page.

edit flag offensive delete link more


That is pretty much what I figured, I was just hoping there was another way. The package is graph-tool which is basically C++ code with a python wrapper and so I've heard a lot of people having trouble using it and there is a post on here about using it in ROS, but it has yet to be answered. Thank you!

mikevillan gravatar image mikevillan  ( 2023-04-06 20:11:35 -0500 )edit

answered 2023-04-08 09:16:21 -0500

Mike Scheutzow gravatar image

It is unclear what your goal is.

Do you understand the distinction between a "system package" and a "ros package"?

It's common for a ros package/node to depend on a system package/library. A system package is built outside of the ros world, and is typically installed as a library somewhere in /usr. Your ros node then uses this library.

If the library you want to use is available through ubuntu apt or pip, you should simply be declaring this system dependency in the CMakeLists.txt file for your ros package.

edit flag offensive delete link more

Question Tools



Asked: 2023-04-05 22:32:36 -0500

Seen: 117 times

Last updated: Apr 08 '23