ฉันใช้เครื่องมือบรรทัดคำสั่ง catkin เพื่อสร้าง benchmark_catkin ซึ่งเป็น wrapper catkin สำหรับ Google เกณฑ์มาตรฐาน โครงสร้างใช้ไฟล์ 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];
};