Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Build error "ISO C++ forbids zero-size array ‘f_handle’ [-Wpedantic]" only when using snapcraft VM

$
0
0

I'm using the catkin command line tools to build benchmark_catkin, which is a catkin wrapper for Google's benchmark. The build uses a CMakeLists file and always worked fine so far on Ubuntu 18.04. I'm now trying to build this package with snapcraft. Snapcraft has the catkin-tools plugin and sets up a VM before building. However, I'm now getting an error from a system library and the build is not successful:

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

I assume this error is referring to a zero-size array in the libc6-dev library. Since I'm using base: core18 in my snapcraft.yaml and also running an Ubuntu 18.04 system, I'm wondering why I just get the error in the VM. Is this a bug in the library? How can I solve this?


For reference, my snapcraft.yaml file:

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]

On request, here the code around the erroneous line of /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];
};

Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>