fix build with gcc 10 gcc 10 is now defaulting to -fno-common resulting in the following build failures: /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/bin/arm-buildroot-linux-gnueabihf-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -D_FORTIFY_SOURCE=1 -DENABLE_IPV6 -DD_DNS_THREADED -D_REENTRANT -D_THREAD_SAFE -Wall -W -Wno-unused-parameter -Waggregate-return -o dpid dpi.o dpi_socket_dir.o dpid.o dpid_common.o main.o misc_new.o ../dpip/libDpip.a ../dlib/libDlib.a /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: dpi_socket_dir.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: multiple definition of `dpi_errno'; dpi.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: multiple definition of `dpi_errno'; dpi.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: dpid_common.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: multiple definition of `dpi_errno'; dpi.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:64: multiple definition of `sock_set'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:64: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:61: multiple definition of `services_list'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:61: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:58: multiple definition of `dpi_attr_list'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:58: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:55: multiple definition of `numsocks'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:55: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:52: multiple definition of `numdpis'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:52: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:31: multiple definition of `srs_fd'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:31: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:28: multiple definition of `srs_name'; dpid.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid.h:28: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: main.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: multiple definition of `dpi_errno'; dpi.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: first defined here /nvme/rc-buildroot-test/scripts/instance-0/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: misc_new.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: multiple definition of `dpi_errno'; dpi.o:/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/dillo-3.0.5/dpid/dpid_common.h:44: first defined here So add missing extern for srs_fd, numdpis, numsocks, dpi_attr_list, services_list and sock_set Also remove srs_name which is never used and give a name to dpi_errno enum Fixes: - http://autobuild.buildroot.org/results/9c777af97fe50143c6a68f0170fc86c87d8ead3f Signed-off-by: Fabrice Fontaine [Upstream status: sent to jcid@dillo.org] diff -r f60d55c02567 dpid/dpid.c --- a/dpid/dpid.c Fri Oct 05 22:05:08 2018 +0200 +++ b/dpid/dpid.c Thu Aug 27 18:16:50 2020 +0200 @@ -38,6 +38,12 @@ #define QUEUE 5 +int srs_fd; +int numdpis; +int numsocks; +struct dp *dpi_attr_list; +Dlist *services_list; +fd_set sock_set; volatile sig_atomic_t caught_sigchld = 0; char *SharedKey = NULL; diff -r f60d55c02567 dpid/dpid.h --- a/dpid/dpid.h Fri Oct 05 22:05:08 2018 +0200 +++ b/dpid/dpid.h Thu Aug 27 18:16:50 2020 +0200 @@ -25,10 +25,9 @@ /*! \TODO: Should read this from dillorc */ #define SRS_NAME "dpid.srs" -char *srs_name; /*! dpid's service request socket file descriptor */ -int srs_fd; +extern int srs_fd; /*! plugin state information */ @@ -49,19 +48,19 @@ }; /*! Number of available plugins */ -int numdpis; +extern int numdpis; /*! Number of sockets being watched */ -int numsocks; +extern int numsocks; /*! State information for each plugin. */ -struct dp *dpi_attr_list; +extern struct dp *dpi_attr_list; /*! service served for each plugin */ -Dlist *services_list; +extern Dlist *services_list; /*! Set of sockets watched for connections */ -fd_set sock_set; +extern fd_set sock_set; /*! Set to 1 by the SIGCHLD handler dpi_sigchld */ extern volatile sig_atomic_t caught_sigchld; diff -r f60d55c02567 dpid/dpid_common.h --- a/dpid/dpid_common.h Fri Oct 05 22:05:08 2018 +0200 +++ b/dpid/dpid_common.h Thu Aug 27 18:16:50 2020 +0200 @@ -37,10 +37,10 @@ /*! Error codes for dpid */ -enum { +enum dpi_errno { no_errors, dpid_srs_addrinuse /* dpid service request socket address already in use */ -} dpi_errno; +}; /*! Intended for identifying dillo plugins * and related files diff -r f60d55c02567 dpid/main.c --- a/dpid/main.c Fri Oct 05 22:05:08 2018 +0200 +++ b/dpid/main.c Thu Aug 27 18:16:50 2020 +0200 @@ -231,7 +231,7 @@ /* this sleep used to unmask a race condition */ // sleep(2); - dpi_errno = no_errors; + enum dpi_errno error_code = no_errors; /* Get list of available dpis */ numdpis = register_all(&dpi_attr_list); @@ -254,7 +254,7 @@ /* Initialise sockets */ if ((numsocks = init_ids_srs_socket()) == -1) { - switch (dpi_errno) { + switch (error_code) { case dpid_srs_addrinuse: MSG_ERR("dpid refuses to start, possibly because:\n"); MSG_ERR("\t1) An instance of dpid is already running.\n");