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

catkin_make Invoking “make -j4 -l4” failed | due error in cpp file

asked 2018-01-25 23:30:52 -0600

Nebula gravatar image

updated 2023-06-18 09:53:38 -0600

lucasw gravatar image

This error comes when I run catkin_make command in catkin_ws directory. I think there are problems in off_node.ccp file as first error appears which is related to cpp file and leads to further error messages, which I am not able to debug. I added off_node.ccp programme below error message.

Base path: /home/yograj/catkin_ws
Source space: /home/yograj/catkin_ws/src
Build space: /home/yograj/catkin_ws/build
Devel space: /home/yograj/catkin_ws/devel
Install space: /home/yograj/catkin_ws/install
Error(s) in /home/yograj/catkin_ws/src/px4_mavros/package.xml:
- The manifest (with format version 2) must not contain the following tags: run_depend
yograj@yograj-Inspiron-5537:~/catkin_ws$ catkin_make
Base path: /home/yograj/catkin_ws
Source space: /home/yograj/catkin_ws/src
Build space: /home/yograj/catkin_ws/build
Devel space: /home/yograj/catkin_ws/devel
Install space: /home/yograj/catkin_ws/install
Error(s) in /home/yograj/catkin_ws/src/px4_mavros/package.xml:
- The manifest (with format version 2) must not contain the following tags: run_depend
yograj@yograj-Inspiron-5537:~/catkin_ws$ catkin_make
Base path: /home/yograj/catkin_ws
Source space: /home/yograj/catkin_ws/src
Build space: /home/yograj/catkin_ws/build
Devel space: /home/yograj/catkin_ws/devel
Install space: /home/yograj/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/yograj/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/yograj/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/yograj/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/yograj/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/yograj/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.8
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - px4_mavros
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'px4_mavros'
-- ==> add_subdirectory(px4_mavros)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yograj/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/yograj/catkin_ws/build"
####
[ 50%] Building CXX object px4_mavros/CMakeFiles/offb_node.dir/src/offb_node.cpp.o
/home/yograj/catkin_ws/src/px4_mavros/src/offb_node.cpp: In function ‘int main(int, char**)’:
/home/yograj/catkin_ws/src/px4_mavros/src/offb_node.cpp:53:40: error: ‘mavros_msgs::SetMode::Response {aka struct mavros_msgs::SetModeResponse_<std::allocator<void> >}’ has no member named ‘success’
                 offb_set_mode.response.success){
                                        ^
px4_mavros/CMakeFiles/offb_node.dir/build.make:62: recipe for target 'px4_mavros/CMakeFiles/offb_node.dir/src/offb_node.cpp.o' failed
make[2]: *** [px4_mavros/CMakeFiles/offb_node.dir/src/offb_node.cpp.o] Error 1
CMakeFiles/Makefile2:823: recipe for target 'px4_mavros/CMakeFiles/offb_node.dir/all' failed
make[1]: *** [px4_mavros/CMakeFiles/offb_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

Here is programme of off_node.cpp file

#include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>
mavros_msgs::State current_state;
void state_cb(const mavros_msgs::State::ConstPtr& msg){
    current_state = *msg;
}
int main(int argc, char **argv)
{
    ros::init(argc, argv, "offb_node");
    ros::NodeHandle nh;
    ros::Subscriber state_sub = nh.subscribe<mavros_msgs::State>
            ("mavros/state ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-01-26 00:40:56 -0600

ahendrix gravatar image

The relevant error here is on line 53

/home/yograj/catkin_ws/src/px4_mavros/src/offb_node.cpp:53:40: error: ‘mavros_msgs::SetMode::Response {aka struct mavros_msgs::SetModeResponse_<std::allocator<void> >}’ has no member named ‘success’
                 offb_set_mode.response.success

It looks like the response to your service call doesn't contain a member variable named success. Maybe you should look at the docs for that response and find the appropriate member, or a different way to determine success.

edit flag offensive delete link more

Comments

1

This was changed in some version of MAVROS. Now it should be offb_set_mode.response.mode_sent.

l4ncelot gravatar image l4ncelot  ( 2018-01-26 07:37:16 -0600 )edit

same error with

    offb_set_mode.response.mode_sent
Nebula gravatar image Nebula  ( 2018-01-27 01:33:12 -0600 )edit

Hello @Nebula, I am running into the same error as you. When I catkin_make the work space, I get the same error message of: ‘mavros_msgs::SetMode::Response’ has no member named ‘mode_sent’

How did you end up solving the issue? I am running Indigo Ubuntu 14.04

Thanks!

RICKROSs gravatar image RICKROSs  ( 2018-08-08 08:47:01 -0600 )edit

@RICKROSs does it work with offb_set_mode.response.success? I think mode_sent variable was introduced after indigo in MAVROS.

l4ncelot gravatar image l4ncelot  ( 2018-08-09 00:24:28 -0600 )edit

Yes it works with 'offb_set_mode.responde.success'. I was able to catkin_make with no errors. Thanks!

RICKROSs gravatar image RICKROSs  ( 2018-08-09 08:27:35 -0600 )edit

Hello @l4ncelot I am having the same error. error: ‘mavros_msgs::SetMode::Response {aka struct mavros_msgs::SetModeResponse_<std::allocator<void> >}’ has no member named ‘success’ if(sss.response.success){ Both with success and mode_sent. I am using ROS melodic version on Raspberry pi 3 Model B+

Arushi gravatar image Arushi  ( 2019-06-11 02:28:51 -0600 )edit

@Arushi, thats weird... if you look at the definition of the SetMode service here the mode_sent variable should be the right one. Have you tried to clean the whole workspace and rebuild it?

l4ncelot gravatar image l4ncelot  ( 2019-06-11 03:40:26 -0600 )edit

No. But can you please tell me how can I do it?

Arushi gravatar image Arushi  ( 2019-06-11 07:05:58 -0600 )edit
0

answered 2018-08-09 01:04:43 -0600

Nebula gravatar image

In my case, It is now working with

    offb_set_mode.response.mode_sent
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-01-25 23:30:52 -0600

Seen: 1,368 times

Last updated: Aug 09 '18