使用Yocto sdk在cmake中交叉编译protobuf文件

时间:2017-12-24 15:27:20

标签: cmake protocol-buffers yocto

我正在尝试使用Yocto生成的SDK在Docker容器中编译cartographer

SDK运行良好,因为我可以交叉编译我想要的东西,除了制图师。

我遇到的问题是CMakeLists.txt调用protoc(来自protobuf)。我在主机和目标目录中安装了protoc。

add_custom_command(
  OUTPUT "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.cc"
         "${PROJECT_BINARY_DIR}/${DIR}/${FIL_WE}.pb.h"
  COMMAND  ${PROTOBUF_PROTOC_EXECUTABLE}
  ARGS --cpp_out  ${PROJECT_BINARY_DIR} -I
    ${PROJECT_SOURCE_DIR} ${ABS_FIL}
  DEPENDS ${ABS_FIL}
  COMMENT "Running C++ protocol buffer compiler on ${ABS_FIL}"
  VERBATIM
)

我有点困惑,因为虽然protoc已经可用,但我在使用aarch64-poky-linux-编译器时使用x86_64架构调用protoc。这导致找不到库,因为架构在某种程度上是混淆的。 glog也安装在两种架构上:

make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/kalman_filter/kalman_filter_unscented_kalman_filter_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/kalman_filter/kalman_filter_gaussian_distribution_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/common/common_fixed_ratio_sampler_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/common/common_lua_parameter_dictionary_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/common/common_blocking_queue_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/mapping/mapping_probability_values_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/common/common_math_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/common/common_rate_timer_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/mapping_2d/mapping_2d_probability_grid_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/mapping/mapping_trajectory_connectivity_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/mapping/mapping_submaps_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64/usr/lib/libglog.so', needed by 'cartographer/kalman_filter/kalman_filter_pose_tracker_test'.  Stop.
make[2]: *** Waiting for unfinished jobs....

奇怪的是,提到的目录(/ home / yocto / yocto_topdir / tmp / sysroots / raspberrypi-cm3-64)仅在生成SDK时存在于Yocto工作区中。它不是我检查过的CMAKE变量,而是来自其他地方。

简单地在我的容器中解决问题

mkdir -p /home/yocto/yocto_topdir/tmp/sysroots
ln -s /usr/local/oecore-sdk/sysroots/aarch64-poky-linux /home/yocto/yocto_topdir/tmp/sysroots/raspberrypi-cm3-64 

我不把它写成答案,因为它是'黑客'。它只是指向目标

的sysroot的文件夹容器

编辑:添加了更多详细信息

0 个答案:

没有答案