rosserial_esp32 icon indicating copy to clipboard operation
rosserial_esp32 copied to clipboard

Can not compile when using std_msgs/Int8MultiArray

Open MatCapLynx opened this issue 2 years ago • 1 comments

Hi, I'm trying to use an array topic but I get the following error when compiling :

In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h: In member function 'virtual int std_msgs::MultiArrayLayout::deserialize(unsigned char*)':
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:60:123: error: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'}; use 'new' and 'delete' instead [-Werror=class-memaccess]
         this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
                                                                                                                           ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg
         ^~~~~~~~~~~~~~~~~~~
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:65:88: error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
         memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
                                                                                        ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg

There seems to be a problem with MultiArrayLayout.h causing the compilation of all arrays topics to fail. I've tried to modifiy it but I wasn't able to find the fix. Maybe it's a cpp compiler version issue. I'm going to use another solution for now but it would be great if anyone knows how to fix this.

MatCapLynx avatar Mar 04 '22 16:03 MatCapLynx

Hi, I'm trying to use an array topic but I get the following error when compiling :

In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h: In member function 'virtual int std_msgs::MultiArrayLayout::deserialize(unsigned char*)':
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:60:123: error: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'}; use 'new' and 'delete' instead [-Werror=class-memaccess]
         this->dim = (std_msgs::MultiArrayDimension*)realloc(this->dim, dim_lengthT * sizeof(std_msgs::MultiArrayDimension));
                                                                                                                           ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg
         ^~~~~~~~~~~~~~~~~~~
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:65:88: error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
         memcpy( &(this->dim[i]), &(this->st_dim), sizeof(std_msgs::MultiArrayDimension));
                                                                                        ^
In file included from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayLayout.h:8,
                 from /home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/Float32MultiArray.h:8,
                 from ../main/rover_esp32.cpp:4:
/home/xavieragx/esp/esp-idf/components/rosserial_esp32/include/std_msgs/MultiArrayDimension.h:12:9: note: 'std_msgs::MultiArrayLayout::_dim_type' {aka 'class std_msgs::MultiArrayDimension'} declared here
   class MultiArrayDimension : public ros::Msg

There seems to be a problem with MultiArrayLayout.h causing the compilation of all arrays topics to fail. I've tried to modifiy it but I wasn't able to find the fix. Maybe it's a cpp compiler version issue. I'm going to use another solution for now but it would be great if anyone knows how to fix this.

I am facing the same issue. Did somebody find a solution for how to use any MultiArrays based on MultiArrayLayout.h in rosserial with ESP-IDF?

NikiBob avatar Jan 30 '23 14:01 NikiBob