Robert Scheck <b...@robert-scheck.de> writes: > Hello folks, > > trying to build BIRD 2.0.7 using GCC 10 (which landed in Fedora these days) > leads to a build failure like this: > > /usr/bin/ld: > obj/conf/cf-lex.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/conf/conf.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: multiple > definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/filter/filter.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/filter/data.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/filter/f-util.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/filter/tree.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/filter/trie.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/filter/inst-gen.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/a-path.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/a-set.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/cmds.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: multiple > definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/iface.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/neighbor.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/proto.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/rt-attr.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/rt-dev.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/rt-fib.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/rt-show.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/nest/rt-table.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/bfd/bfd.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/bfd/packets.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/babel/babel.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/babel/packets.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/bgp/attrs.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/bgp/bgp.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/bgp/packets.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/mrt/mrt.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/dbdes.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/hello.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/iface.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/lsack.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/lsalib.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/lsreq.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/lsupd.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/neighbor.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/ospf.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/packet.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/rt.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/ospf/topology.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/perf/perf.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/pipe/pipe.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/radv/packets.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/radv/radv.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rip/packets.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rip/rip.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rpki/rpki.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rpki/packets.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rpki/tcp_transport.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rpki/ssh_transport.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/rpki/transport.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/proto/static/static.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/sysdep/linux/netlink.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/sysdep/unix/krt.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > /usr/bin/ld: > obj/sysdep/unix/main.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > multiple definition of `rta_dest_names'; > obj/conf/cf-parse.tab.o:/builddir/build/BUILD/bird-2.0.7/./nest/route.h:461: > first defined here > collect2: error: ld returned 1 exit status > > https://gcc.gnu.org/gcc-10/porting_to.html gives a pointer that this is > related to a common mistake in C related to missing "extern" to global > variables in a header file. > > Any chance for a patch (rather to suggest -fno-common)? Thank you.
I think the below patch (against master) ought to fix it? Don't have a GCC v10 handy to test with, but at least it doesn't seem to break anything on GCC v9 :) I think the same patch ought to apply against Bird 2.0.7 as well... -Toke diff --git a/nest/route.h b/nest/route.h index d2a07f09..b927db5f 100644 --- a/nest/route.h +++ b/nest/route.h @@ -458,7 +458,7 @@ typedef struct rta { protocol-specific metric is availabe */ -const char * rta_dest_names[RTD_MAX]; +extern const char * rta_dest_names[RTD_MAX]; static inline const char *rta_dest_name(uint n) { return (n < RTD_MAX) ? rta_dest_names[n] : "???"; }