This may be due to bugs in gcc or the linker. The nest of reports is
inconclusive (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86490
https://sourceware.org/bugzilla/show_bug.cgi?id=23411
https://www.bountysource.com/issues/60348964-multiple-prevailing-defs-for-unused-variable-in-lto-mode
)

It's likely that part of the problem is that some component didn't decide
that the two different copies of liboafs_ubik.la were the same file and did
not need to be processed independently:
(adding -v after gcc to the actual libtool command)

 /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin
/usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccoT0MYW.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -flto --build-id --eh-frame-hdr -m
elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o pt_util
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/8/crtbeginS.o -L/usr0/openafs/lib
-L/usr/lib/gcc/x86_64-linux-gnu/8
-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib -L/lib/x86_64-linux-gnu
-L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. pt_util.o ptutils.o ptubik.o
utils.o map.o >>>>../../src/ptserver/.libs/liboafs_prot.a
/usr0/openafs/src/ubik/.libs/liboafs_ubik.a
../../src/ubik/.libs/liboafs_ubik.a<<<<
/usr0/openafs/src/auth/.libs/liboafs_auth.a  ...

This patch seems to work around it. It should be safe on all platforms,
since part of what libtool DOES is track and insert indirect dependencies.

diff --git a/src/tptserver/Makefile.in b/src/tptserver/Makefile.in
index cbde711e2..b277a7599 100644
--- a/src/tptserver/Makefile.in
+++ b/src/tptserver/Makefile.in
@@ -24,7 +24,6 @@ INCLS=${TOP_INCDIR}/ubik.h \
        ptint.h

 LIBS_common= \
-       $(top_builddir)/src/ubik/liboafs_ubik.la \
        $(top_builddir)/src/sys/liboafs_sys.la \
        $(top_builddir)/src/rx/liboafs_rx.la \
        $(top_builddir)/src/rxstat/liboafs_rxstat.la \
@@ -36,6 +35,7 @@ LIBS_common= \

 LIBS_server= \
        $(top_builddir)/src/audit/liboafs_audit.la \
+       $(top_builddir)/src/ubik/liboafs_ubik.la \
        $(LIBS_common)

 LIBS_client= \

Reply via email to