lxc / lxcfs

FUSE filesystem for LXC
https://linuxcontainers.org/lxcfs
Other
1.05k stars 251 forks source link

meson compile error: -Wmissing-field-initializers #576

Closed kanghuzai closed 1 year ago

kanghuzai commented 1 year ago
# uname -a
Linux szsjhl-ts-xxx.lan 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
# yum list *fuse*
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
................................................................

Installed Packages
fuse.x86_64                                                                                     2.9.2-11.el7                                                        @base           
fuse3.x86_64                                                                                    3.6.1-4.el7                                                         @extras         
fuse3-devel.x86_64                                                                              3.6.1-4.el7                                                         @extras         
fuse3-libs.x86_64                                                                               3.6.1-4.el7                                                         @extras         
glusterfs-fuse.x86_64                                                                           9.6-1.el7                                                           @centos-gluster9
Available Packages
afuse.x86_64                                                                                    0.4.1-3.el7                                                         epel            
ceph-fuse.x86_64                                                                                2:12.2.11-0.el7                                                     ceph-luminous   
fuse-afp.x86_64                                                                                 0.8.1-35.el7                                                        epel            
fuse-devel.i686                                                                                 2.9.2-11.el7                                                        base            
fuse-devel.x86_64                                                                               2.9.2-11.el7                                                        base            
fuse-dislocker.x86_64                                                                           0.7.3-1.el7                                                         epel            
fuse-encfs.x86_64                                                                               1.9.5-1.el7                                                         epel            
fuse-libs.i686                                                                                  2.9.2-11.el7                                                        base            
fuse-libs.x86_64                                                                                2.9.2-11.el7                                                        base            
fuse-overlayfs.x86_64                                                                           0.7.2-6.el7_8                                                       extras          
fuse-python.x86_64                                                                              0.2.1-10.el7                                                        epel            
fuse-sshfs.x86_64                                                                               2.10-1.el7                                                          epel            
fuseiso.x86_64                                                                                  20070708-15.el7                                                     base            
fusesource-pom.noarch                                                                           1.9-7.el7                                                           base            
golang-bazil-fuse-devel.noarch                                                                  0-0.2.20160811git371fbbd.el7                                        epel            
golang-bazil-fuse-unit-test-devel.x86_64                                                        0-0.2.20160811git371fbbd.el7                                        epel            
golang-github-billziss-gh-cgofuse-devel.noarch                                                  1.0.4-2.el7                                                         epel            
golang-github-billziss-gh-cgofuse-unit-test-devel.x86_64                                        1.0.4-2.el7                                                         epel            
gvfs-fuse.x86_64                                                                                1.36.2-7.el7_9                                                      updates         
libconfuse.x86_64                                                                               2.7-7.el7                                                           epel            
libconfuse-devel.x86_64                                                                         2.7-7.el7                                                           epel            
orangefs-fuse.x86_64                                                                            2.9.7-1.el7                                                         epel            
ostree-fuse.x86_64                                                                              2019.1-2.el7                                                        extras          
perl-Fuse.x86_64                                                                                0.16.1-10.el7                                                       epel            
python2-defusedxml.noarch                                                                       0.5.0-2.el7                                                         epel            
python2-llfuse.x86_64                                                                           1.0-2.el7                                                           epel            
python36-defusedxml.noarch                                                                      0.5.0-2.el7                                                         epel            
python36-llfuse.x86_64                                                                          1.0-2.el7                                                           epel            
rbd-fuse.x86_64                                                                                 2:12.2.11-0.el7                                                     ceph-luminous   
s3fs-fuse.x86_64                                                                                1.89-1.el7                                                          epel            
squashfuse.x86_64                                                                               0.1.102-1.el7                                                       epel            
squashfuse-devel.x86_64                                                                         0.1.102-1.el7                                                       epel            
squashfuse-libs.x86_64                                                                          0.1.102-1.el7                                                       epel            
xrootd-fuse.x86_64                                                                              1:5.1.1-1.el7                                                       epel            
# meson setup -Dinit-script=systemd --prefix=/usr build/
The Meson build system
Version: 0.55.1
Source dir: /root/lxcfs
Build dir: /root/lxcfs/build
Build type: native build
Project name: lxcfs
Project version: 5.0.2
C compiler for the host machine: cc (gcc 4.8.5 "cc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)")
C linker for the host machine: cc ld.bfd 2.27-34
Host machine cpu family: x86_64
Host machine cpu: x86_64

................................................................

Message: lxcfs 5.0.2
         FUSE version:          3.6.1
         bin directory:         /usr/bin
         lib directory:         /usr/lib64
         data directory:        /usr/share
         local state directory:     /var
         prefix directory:      /usr
         runtime directory:     /run
         sysconf directory:     /etc
         lxc conf directory:        /usr/share/lxc/config/common.conf.d
         lxcfs directory:       /usr/lib64/lxcfs
         lxcfs shared directory:    /usr/share/lxcfs
         lxcfs build root directory:    /root/lxcfs/build
         lxcfs source root directory:   /root/lxcfs
         init system(s):        ['systemd']
         tests:             false
         documentation:         true
Build targets in project: 21

Found ninja-1.10.2 at /usr/bin/ninja
# meson compile -C build/
Found runner: /usr/bin/ninja
ninja: Entering directory `build'
[7/22] Compiling C object liblxcfs.so.p/src_utils.c.o
../src/utils.c: In function ‘recv_creds’:
../src/utils.c:201:9: warning: missing initializer for field ‘msg_name’ of ‘struct msghdr’ [-Wmissing-field-initializers]
  struct msghdr msg = {};
         ^
In file included from /usr/include/sys/socket.h:39:0,
                 from ../src/utils.h:10,
                 from ../src/utils.c:22:
/usr/include/bits/socket.h:227:11: note: ‘msg_name’ declared here
     void *msg_name;  /* Address to send to/receive from.  */
           ^
[9/22] Compiling C object lxcfs.p/src_lxcfs.c.o
../src/lxcfs.c:1147:2: warning: missing initializer for field ‘name’ of ‘const struct option’ [-Wmissing-field-initializers]
  {        },
  ^
In file included from ../src/lxcfs.c:10:0:
/usr/include/getopt.h:107:15: note: ‘name’ declared here
   const char *name;
               ^
[12/22] Compiling C object liblxcfs.so.p/src_lxcfs.c.o
../src/lxcfs.c:1147:2: warning: missing initializer for field ‘name’ of ‘const struct option’ [-Wmissing-field-initializers]
  {        },
  ^
In file included from ../src/lxcfs.c:10:0:
/usr/include/getopt.h:107:15: note: ‘name’ declared here
   const char *name;
               ^
[16/22] Compiling C object liblxcfs.so.p/src_proc_fuse.c.o
../src/proc_fuse.c: In function ‘proc_diskstats_read’:
../src/proc_fuse.c:507:9: warning: missing initializer for field ‘major’ of ‘struct lxcfs_diskstats’ [-Wmissing-field-initializers]
  struct lxcfs_diskstats stats = {};
         ^
../src/proc_fuse.c:476:15: note: ‘major’ declared here
  unsigned int major;  /*  1 - major number */
               ^
../src/proc_fuse.c: In function ‘proc_meminfo_read’:
../src/proc_fuse.c:1216:9: warning: missing initializer for field ‘hierarchical_memory_limit’ of ‘struct memory_stat’ [-Wmissing-field-initializers]
  struct memory_stat mstat = {};
         ^
../src/proc_fuse.c:46:11: note: ‘hierarchical_memory_limit’ declared here
  uint64_t hierarchical_memory_limit;
           ^
[22/22] Generating lxcfs.service with a custom command
# cat /usr/include/bits/socket.h | tail -n +223 | head -n 20
/* Structure describing messages sent by
   `sendmsg' and received by `recvmsg'.  */
struct msghdr
  {
    void *msg_name;     /* Address to send to/receive from.  */
    socklen_t msg_namelen;  /* Length of address data.  */

    struct iovec *msg_iov;  /* Vector of data to send/receive into.  */
    size_t msg_iovlen;      /* Number of elements in the vector.  */

    void *msg_control;      /* Ancillary data (eg BSD filedesc passing). */
    size_t msg_controllen;  /* Ancillary data buffer length.
                   !! The type should be socklen_t but the
                   definition of the kernel is incompatible
                   with this.  */

    int msg_flags;      /* Flags on received message.  */
  };

/* Structure used for storage of ancillary data object information.  */
mihalicyn commented 1 year ago

CentOS 7 toolchain is really old. I can suggest you use the scl devtoolset's to get a more recent GCC version.

stgraber commented 1 year ago

Closing as this is caused by an old compiler.