Saya menggunakan alat baris perintah catkin untuk membuat benchmark_catkin, yang merupakan pembungkus catkin untuk Google tolok ukur. Pembuatannya menggunakan file CMakeLists dan sejauh ini selalu berfungsi dengan baik di Ubuntu 18.04. Saya sekarang mencoba membuat paket ini dengan snapcraft. Snapcraft memiliki plugin catkin-tools dan menyiapkan VM sebelum membangun. Namun, saya sekarang mendapatkan kesalahan dari perpustakaan sistem dan pembangunan tidak berhasil:
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
Saya berasumsi kesalahan ini merujuk pada array berukuran nol di perpustakaan libc6-dev. Karena saya menggunakan base: core18
di snapcraft.yaml dan juga menjalankan sistem Ubuntu 18.04, saya bertanya-tanya mengapa saya mendapatkan kesalahan di VM. Apakah ini bug di perpustakaan? Bagaimana saya bisa memecahkan masalah ini?
Untuk referensi, file snapcraft.yaml saya:
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]
Berdasarkan permintaan, berikut kode di sekitar baris /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h yang salah:
/* File handle structure. */
struct file_handle
{
unsigned int handle_bytes;
int handle_type;
/* File identifier. */
unsigned char f_handle[0];
};