我正在使用 catkin 命令行工具构建benchmark_catkin,它是 Google 基准测试的 catkin 包装器。该构建使用 CMakeLists 文件,并且到目前为止在 Ubuntu 18.04 上一直运行良好。我现在正在尝试使用 snapcraft 构建这个包。Snapcraft 有 catkin-tools 插件,并在构建之前设置了一个 VM。但是,我现在从系统库中收到错误并且构建不成功:
In file included from /root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl.h:61:0,
from /root/parts/workspace/install/usr/include/fcntl.h:35,
from /root/parts/workspace/build/benchmark_catkin/benchmark_src-prefix/src/benchmark_src/src/sysinfo.cc:23:
/root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:355:27: error: ISO C++ forbids zero-size array ‘f_handle’ [-Wpedantic]
unsigned char f_handle[0];
^
In file included from /root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl.h:61:0,
from /root/parts/workspace/install/usr/include/fcntl.h:35,
from /root/parts/workspace/build/benchmark_catkin/benchmark_src-prefix/src/benchmark_src/src/timers.cc:23:
/root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:355:27: error: ISO C++ forbids zero-size array ‘f_handle’ [-Wpedantic]
unsigned char f_handle[0];
^
make[5]: *** [src/CMakeFiles/benchmark.dir/sysinfo.cc.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [src/CMakeFiles/benchmark.dir/timers.cc.o] Error 1
make[4]: *** [src/CMakeFiles/benchmark.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [all] Error 2
make[2]: *** [benchmark_src-prefix/src/benchmark_src-stamp/benchmark_src-build] Error 2
make[1]: *** [CMakeFiles/benchmark_src.dir/all] Error 2
make: *** [all] Error 2
我假设这个错误是指 libc6-dev 库中的零大小数组。由于我base: core18
在我的 snapcraft.yaml 中使用并且还运行 Ubuntu 18.04 系统,我想知道为什么我只是在 VM 中收到错误。这是库中的错误吗?我该如何解决这个问题?
作为参考,我的 snapcraft.yaml 文件:
name: nav
base: core18
version: 'w1.0'
summary: The Nav Software
description: |
grade: devel
confinement: strict
plugs:
network:
network-bind:
parts:
core-dep:
plugin: nil
build-packages:
- autoconf
- libtool
- git
workspace:
plugin: catkin-tools
source: .
catkin-packages: [catkin_simple, glog_catkin, gflags_catkin, benchmark_catkin]
after: [core-dep]
根据要求,这里是 /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h 错误行周围的代码:
/* File handle structure. */
struct file_handle
{
unsigned int handle_bytes;
int handle_type;
/* File identifier. */
unsigned char f_handle[0];
};