ERROR: (08-19 16:25:32.010) /apollo/RS_SDK_V1.2/rs_read_RTK/BUILD:22:1: Linking of rule '//RS_SDK_V1.2/rs_read_RTK:read_RTK' failed (Exit 1).
bazel-out/local-fastbuild/bin/RS_SDK_V1.2/rs_read_RTK/_objs/read_RTK/RS_SDK_V1.2/rs_read_RTK/src/read_RTK.pic.o: In function `_GLOBAL__sub_I_read_RTK.cpp':
read_RTK.cpp:(.text.startup+0x5b): undefined reference to `boost::system::generic_category()'
read_RTK.cpp:(.text.startup+0x67): undefined reference to `boost::system::generic_category()'
read_RTK.cpp:(.text.startup+0x73): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status
解决:
cc_library(
name = "rs_RTK",
srcs = ["src/rs_RTK.cpp",
"//RS_SDK_V1.2/rs_common:common_hdrs"
],
hdrs = ["include/rs_RTK.h"],
copts = [
"-IRS_SDK_V1.2/rs_common/include",
# "-IRS_SDK_V1.2/rs_read_RTK",
"-IRS_SDK_V1.2",
# "-Iexternal/yaml_cpp/include", # 因为yaml库中写了includes配置项,includes可以继承
"-O3",
"-Wall",
"-std=c++11",
"-fPIC",
],
linkopts = ["-lboost_system",
"-lboost_filesystem"
],
)
ERROR: (08-19 16:55:40.467) /apollo/RS_SDK_V1.2/rs_read_RTK/BUILD:28:1: C++ compilation of rule '//RS_SDK_V1.2/rs_read_RTK:read_RTK' failed (Exit 1).
In file included from RS_SDK_V1.2/rs_read_RTK/include/rs_RTK.h:4:0,
from RS_SDK_V1.2/rs_read_RTK/src/read_RTK.cpp:1:
RS_SDK_V1.2/rs_common/include/rs_common/msg/rs_msg/lidar_points_msg.h:26:23: fatal error: pcl/io/io.h: No such file or directory
#include <pcl/io/io.h>
ERROR: (08-19 16:58:16.263) /apollo/RS_SDK_V1.2/rs_read_RTK/BUILD:29:1: C++ compilation of rule '//RS_SDK_V1.2/rs_read_RTK:read_RTK' failed (Exit 1).
In file included from external/pcl/pcl/common/io.h:45:0,
from external/pcl/pcl/io/io.h:43,
from RS_SDK_V1.2/rs_common/include/rs_common/msg/rs_msg/lidar_points_msg.h:26,
from RS_SDK_V1.2/rs_read_RTK/include/rs_RTK.h:4,
from RS_SDK_V1.2/rs_read_RTK/src/read_RTK.cpp:1:
external/pcl/pcl/pcl_base.h:49:27: fatal error: Eigen/StdVector: No such file or directory
#include <Eigen/StdVector>
^
compilation terminated.
解决:
# load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "rs_RTK",
srcs = ["src/rs_RTK.cpp",
"//RS_SDK_V1.2/rs_common:common_hdrs"
],
hdrs = ["include/rs_RTK.h"],
deps = [
"@yaml_cpp//:yaml",
"@pcl",
"@eigen",
],
copts = [
"-IRS_SDK_V1.2/rs_common/include",
# "-IRS_SDK_V1.2/rs_read_RTK",
"-IRS_SDK_V1.2",
# "-Iexternal/yaml_cpp/include", # 因为yaml库中写了includes配置项,includes可以继承
"-O3",
"-Wall",
"-std=c++11",
"-fPIC",
],
linkopts = ["-lboost_system",
"-lboost_filesystem"
],
)
cc_binary(
name = "read_RTK",
srcs = ["src/read_RTK.cpp"],
deps = [
":rs_RTK",
],
copts = [
"-IRS_SDK_V1.2/rs_common/include",
# "-IRS_SDK_V1.2/rs_read_RTK",
"-IRS_SDK_V1.2",
# "-Iexternal/yaml_cpp/include", # 因为yaml库中写了includes配置项,includes可以继承
"-O3",
"-Wall",
"-std=c++11",
"-fPIC",
],
)
报错:
ERROR: (08-19 17:14:31.605) /apollo/RS_SDK_V1.2/rs_read_RTK/BUILD:32:1: undeclared inclusion(s) in rule '//RS_SDK_V1.2/rs_read_RTK:read_RTK':
this rule is missing dependency declarations for the following files included by 'RS_SDK_V1.2/rs_read_RTK/src/read_RTK.cpp':
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/sensor_manager/sensor_manager.h'
'RS_SDK_V1.2/rs_lidar/include/rs_lidar/lidar_base.h'
'RS_SDK_V1.2/rs_lidar/include/rs_lidar/input.h'
'RS_SDK_V1.2/rs_lidar/include/rs_lidar/rslidar_packet.h'
'RS_SDK_V1.2/rs_lidar/include/rs_lidar/rslidar_decoder.hpp'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/gnss/gnss_BT708.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/gnss/gnss_base.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/serial/rs_serial.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/imu/imu_TL740D.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/imu/imu_base.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/imu/imu_HWT605.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/ins/ins_XWG13668.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/ins/ins_base.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/odom/odom_byd.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/odom/odom_base.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/odom/can_bridge.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/odom/controlcan.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/odom/odom_jili.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/driver/odom/odom_bieke.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/ros/imu_ros_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/ros/gnss_ros_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/ros/odom_ros_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/ros/lidar_points_ros_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/ros/lidar_packets_ros_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/proto/imu_proto_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/proto/lidar_points_proto_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/proto/lidar_packets_proto_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/proto/gnss_proto_adapter.h'
'RS_SDK_V1.2/rs_sensor/include/rs_sensor/proto/odom_proto_adapter.h'.
解决办法:
模仿rs_commom模块下的BUILD:
# 在rs_common中的所有头文件
filegroup(
name = "common_hdrs",
srcs = ["include/rs_common/common.h",]
+ glob([
"include/rs_common/yaml/*.h",
"include/rs_common/debug/*.h",
"include/rs_common/interface/**/*.h",
"include/rs_common/msg/*.h",
"include/rs_common/msg/**/*.h",
"include/rs_common/proto/*.h",
"include/rs_common/proto/*.hpp",
]),
)
rs_lidar模块下的BUILD增加:
# 在rs_lidar中的所有头文件
filegroup(
name = "lidar_hdrs",
srcs = glob([
"include/rs_lidar/*.h",
"include/rs_lidar/*.hpp",
]),
)
rs_sensor模块下的BUILD增加:
# 在rs_sensor中的所有头文件
filegroup(
name = "sensor_hdrs",
srcs = ["include/rs_sensor/sensor_manager/sensor_manager.h",]
+ glob([
"include/rs_sensor/driver/**/*.h",
"include/rs_sensor/driver/serial/rs_serial.h",
"include/rs_sensor/driver/imu/*.h",
"include/rs_sensor/proto/*.h",
"include/rs_sensor/ros/*.h",
]),
)
rs_read_RTK下的BUILD:
cc_library(
name = "rs_RTK",
srcs = ["src/rs_RTK.cpp",
"//RS_SDK_V1.2/rs_common:common_hdrs",
# "//RS_SDK_V1.2/rs_lidar/include/rs_lidar/*.h",
"//RS_SDK_V1.2/rs_lidar:lidar_hdrs",
"//RS_SDK_V1.2/rs_sensor:sensor_hdrs",
],
hdrs = ["include/rs_RTK.h"],
deps = [
"@yaml_cpp//:yaml",
"@pcl",
"@eigen",
],
copts = [
"-IRS_SDK_V1.2/rs_common/include",
"-IRS_SDK_V1.2/rs_sensor/include",
"-IRS_SDK_V1.2/rs_lidar/include",
# "-IRS_SDK_V1.2/rs_read_RTK",
"-IRS_SDK_V1.2",
# "-Iexternal/yaml_cpp/include", # 因为yaml库中写了includes配置项,includes可以继承
"-O3",
"-Wall",
"-std=c++11",
"-fPIC",
],
linkopts = ["-lboost_system",
"-lboost_filesystem"
],
)
注意:
src = 中"//RS_SDK_V1.2/rs_lidar/include/rs_lidar/*.h",
不行,否则报错:
ERROR: (08-19 17:19:44.411) /apollo/RS_SDK_V1.2/rs_lidar/BUILD:48:1: //RS_SDK_V1.2/rs_lidar:lidar_hdrs: invalid label 'include/rs_lidar/*.h' in element 0 of attribute 'srcs' in 'filegroup' rule: invalid target name 'include/rs_lidar/*.h': target names may not contain '*'.
ERROR: (08-19 17:19:44.441) /apollo/RS_SDK_V1.2/rs_read_RTK/BUILD:4:1: Target '//RS_SDK_V1.2/rs_lidar:lidar_hdrs' contains an error and its package is in error and referenced by '//RS_SDK_V1.2/rs_read_RTK:rs_RTK'.
ERROR: (08-19 17:19:44.464) Analysis of target '//RS_SDK_V1.2/rs_read_RTK:rs_RTK' failed; build aborted.
```bash
ERROR: (08-21 10:08:46.128) /apollo/RS_SDK_V1.2/rs_read_RTK/BUILD:39:1: C++ compilation of rule '//RS_SDK_V1.2/rs_read_RTK:read_RTK' failed (Exit 1).
In file included from RS_SDK_V1.2/rs_read_RTK/src/read_RTK.cpp:1:0:
RS_SDK_V1.2/rs_read_RTK/include/rs_RTK.h:27:26: error: 'GnssMsg' does not name a type
void RTKCallback(const GnssMsg& msg);
^
RS_SDK_V1.2/rs_read_RTK/include/rs_RTK.h:27:35: error: ISO C++ forbids declaration of 'msg' with no type [-fpermissive]
void RTKCallback(const GnssMsg& msg);
error: 'GnssMsg' does not name a type
void RTKCallback(const GnssMsg& msg);
(已经#include <rs_common/msg/rs_msg/gnss_msg.h>)
rs_common/msg/rs_msg/gnss_msg.h:
#pragma once
#include <string>
#include <array>
namespace robosense
{
namespace common
{
/**
* @brief Gnss Message for Robosense SDK.
* @detail Robosense GnssMsg is defined for passing Gnss related information accross different modules
* If ROS is turned on , we provide translation functions between ROS message and Robosense message
* If Proto is turned on , we provide translation functions between Protobuf message and Robosense message
*
*/
struct alignas(16) GnssMsg
{
double timestamp = 0.0;
uint32_t seq = 0;
std::string parent_frame_id = ""; ///< the frame id of its coordinate(***equal to frame_id in ROS***)
std::string frame_id = ""; ///< the frame id of its self
int status = 0; ///< the Gnss status
uint8_t type = 0; ///< GNSS Sensor type, 'R' : RTK 'G' : GPS
uint8_t sat_cnt = 0; ///< Number of satellite connected. Should be at least 8 for good accuracy.
std::array<double, 3> pos{}; ///< Interms of [lat lon alt]
std::array<double, 9> pos_cov{}; ///< Position covariance, unit: meter^2
std::array<double, 3> orien{}; ///< Orientation, [row pitch yaw], unit: rad
std::array<double, 9> orien_cov{}; ///< Orientation covariance, unit: rad^2
std::array<double, 3> linear_vel{}; ///< Linear velocity, [x,y,z], unit: m/s
std::array<double, 9> linear_vel_cov{}; ///< Linear velocity covariance, unit: m^2/s^2
};
} // namespace common
} // namespace robosense
解决:加上common::
void RTKCallback(const common::GnssMsg& msg);
问题:
原因: