# catkin_make could not find roslib

Hello everyone,

First of all, thank you for this amazingly helpful forum. I have been using ROS for a few months now, but I only decide to write a question here today.

My computer runs a 64-bit Debian GNU/Linux 10 (buster) OS, and a version of ROS that, as far as I understand, corresponds to Melodic Morenia (though rosversion -d says Debian). I have not performed the installation of ROS myself.

I am trying to conceive a data acquisition and control system using ROS, based on tools found within the ROS ecosystem, and on homemade packages (developed using C++). I would like now to make my system be able to control a motor using the CANOpen communication protocol, which led me to try to install the "ros_canopen" set of packages. However, I am currently not able to build these packages.

My project's directory (named "autofleet") is located within a Catkin workspace, and corresponds besides to a Git repository. It contains a couple of homemade packages, along with some other packages (including the "ros_canopen" set) that have been defined as Git submodules of my superproject "autofleet".

I am used to employ the catkin_make command, with various options, experimenting especially with the blacklist management capacity offered by -DCATKIN_BLACKLIST_PACKAGES. I happen though to be struggling to build the packages included in "ros_canopen". What I nevertheless tried to do today is to build them one after the other, and to deal with the errors either by removing from or adding to Catkin's blacklist some packages I had already cloned within my project, or by defining new Git submodules. This method allowed me to manage to build most of the packages found in "ros_canopen", until I crossed swords with "canopen_chain_node".

The latter depends indeed on "pluginlib", which I had not cloned yet within my project. I hence did so, and then tried to build the appropriate packages of my Catkin workspace using the catkin_make command, adding especially "canopen_chain_node" to the blacklist. I then obtained the following error:

-- Could NOT find roslib (missing: roslib_DIR)
-- Could not find the required component 'roslib'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.

CMake Error at /usr/share/catkin/cmake/catkinConfig.cmake:82 (find_package):
Could not find a package configuration file provided by "roslib" with any of the following names:

roslibConfig.cmake
roslib-config.cmake

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


This is where I get confused, because I thought that "roslib" was part of the basic ROS installation, and I did not understand how Catkin / Cmake could not find the corresponding components in order to properly build the "pluginlib" package...

Besides, running find / -name roslib* 2>/dev/null gives me in particular the following results:

/usr/lib/python2.7 ...
edit retag close merge delete

Sort by » oldest newest most voted

There are several points here, so I'm going to run through them in no particular order.

• ROS is probably not installed properly. rosversion -d should say melodic. roslib should be present under /opt/ros/melodic/, not in the root. If you have access to sudo, then follow the installation guide and get ROS set up properly. If you do not, find out who does and get them to install ROS properly.
• You are not using catkin properly to build ROS software. Take a look at the catkin tutorials and the catkin_tools documentation. They will teach you about how catkin works, what a workspace is, how to build a package, etc. All the stuff you need to know to work with ROS software.
• You are using git submodules. You should not use git submodules. Add each additional package you want to build to your workspace and build it using catkin.
• Although catkin_make is the default, it's not recommend anymore. You should use catkin_tools instead, specifically the catkin build command.
• You shouldn't need to blacklist packages. catkin_tools provides commands for building individual packages, building one package at a time, etc.
more

The official recommendation is to is catkin_make_isolated.

( 2020-06-29 20:19:56 -0500 )edit

Thanks a lot for your answers. I realize that I have been doing things the wrong way for months now... I am going to contact the person who dealt with the installation of ROS on my computer, to send him the link to this page, and to ask him what we could do to solve this problem (before starting messing up stuff with sudo). I am though surprised to learn that I was also not using catkin properly. I guess I would need to browse the different tutorials again.

( 2020-06-30 01:24:01 -0500 )edit

It's likely the OP's machine was setup with UpstreamPackages, or at least for Catkin and some other Python dependencies.

( 2020-06-30 01:56:04 -0500 )edit

The latter depends indeed on "pluginlib", which I had not cloned yet within my project

@JulienTemplai: please try to avoid building packages from source unless absolutely necessary.

ROS packages are typically not built from sources by users, as the ones regularly used are released through the ROS buildfarm. Try to use apt install ros-melodic-<pkg-name> as much as possible.

If you must build from source (and there are valid reasons to do so), use rosdep to install as many dependencies as deb pkgs, and avoid cloning more packages from source.

There are Q&As which may provide some more insight into this process, such as #q320046, #q252478 and #q215059.

Edit: if you currently have a mixed installation with packages from UpstreamPackages and regular ROS packages, you'll want to take care of this first though.

( 2020-06-30 02:03:08 -0500 )edit

@gvdhoorn : Thank you for these details. I was not aware of the distinction between ROS packages from UpstreamPackages and from package.ros.org, neither of the recommendation against mixing them on the same system. I should indeed probably start with investigating about these topics.

( 2020-06-30 03:35:16 -0500 )edit