ApolloAuto/apollo-platform

Question: missing serializationLength function in generated protobuf files

Closed this issue · 1 comments

I have been trying to cross-compile one apollo module onto qnx. Most of ROS packages in this repo (except a few python ros packages which do not matter for the moment) are already x-compiled onto QNX. The compilation errors are as the following:

In file included from /home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/publisher.h:34:0,
                 from /home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/node_handle.h:32,
                 from /home/cdgros/apollo_stage/ros/include/ros/ros.h:45,
                 from /home/cdgros/code/avic/baidu/apollo/modules/../modules/canbus/canbus.h:29,
                 from /home/cdgros/code/avic/baidu/apollo/modules/canbus/canbus.cc:17:
/home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/serialization.h: In instantiation of 'static uint32_t ros::serialization::Serializer<T, Enable>::serializedLength(typename boost::call_traits<T>::param_type) [with T = apollo::canbus::Chassis; Enable = void; uint32_t = unsigned int; typename boost::call_traits<T>::param_type = const apollo::canbus::Chassis&]':
/home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/serialization.h:173:41:   required from 'uint32_t ros::serialization::serializationLength(const T&) [with T = apollo::canbus::Chassis; uint32_t = unsigned int]'
/home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/serialization.h:849:37:   required from 'ros::SerializedMessage ros::serialization::serializeMessage(const M&) [with M = apollo::canbus::Chassis]'
/home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/publisher.h:123:26:   required from 'void ros::Publisher::publish(const M&) const [with M = apollo::canbus::Chassis]'
/home/cdgros/code/avic/baidu/apollo/modules/../modules/common/adapters/adapter_manager.h:238:3:   required from here
/home/cdgros/baidu_ws/qnx/install/opt/ros/autonomoose/include/ros/serialization.h:145:34: error: 'const class apollo::canbus::Chassis' has no member named 'serializationLength'
     return t.serializationLength();
                                  ^
compilation terminated due to -Wfatal-errors.

How does this customized ROS know whether it is a standard ros msg or a protobuf defined msg? Does ros publisher treat these two msgs differently? As my understanding, it make senses that 'const class apollo::canbus::Chassis' has no member named 'serializationLength' since it is generated by 'protoc'.

fixed