#1015695 tua: ftbfs with LTO (link time optimization) enabled

#1015695#5
Date:
2022-07-19 17:01:58 UTC
From:
To:
This package currently fails to build (at least on the amd64
architecture) with link time optimizations enabled.  For a background
for LTO please see

https://wiki.debian.org/ToolChain/LTO

The goal is to enable this optimization by default in an upcoming
Debian release in dpkg-buildflags for 64bit architectures.  The goal
is to get this package to build with link time optimizations, or to
explicitly disable link time optimizations for this package build.

To reproduce the build failure, enable the lto optimization in
testing/unstable by adding "optimize=+lto" to DEB_BUILD_MAINT_OPTIONS
in the debian/rules file, or if this macro is unset, just set it:

export DEB_BUILD_MAINT_OPTIONS = optimize=+lto

Please try to fix the build with lto enabled, fixing the packaging or
forwarding the issue upstream. If the issue cannot be fixed,
explicitly disallow building the package with lto by adding to your
rules file:

export DEB_BUILD_MAINT_OPTIONS = optimize=-lto

or adding that string to your existing setting of DEB_BUILD_MAINT_OPTIONS.

The full build log can be found at:
http://qa-logs.debian.net/2022/06/09/dpkglto/tua_4.3-14_unstable_dpkglto.log
The last lines of the build log are at the end of this report.

[...]
  398 |       fscanf (pcd_file, "%lf", &yylval.fval);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  phonesw.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  portalias.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  porttree.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  process.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  prochist.c
In file included from /usr/include/string.h:519,
                 from tua.h:40,
                 from prochist.c:24:
In function ‘strncpy’,
    inlined from ‘ReadALine’ at prochist.c:58:3,
    inlined from ‘read_system_history’ at prochist.c:89:7:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: warning: ‘strncpy’ output may be truncated copying 30 bytes from a string of length 255 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: warning: ‘strncpy’ output may be truncated copying 30 bytes from a string of length 255 [-Wstringop-truncation]
In function ‘strncpy’,
    inlined from ‘ReadALine’ at prochist.c:58:3,
    inlined from ‘read_system_history’ at prochist.c:90:7:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: warning: ‘strncpy’ output may be truncated copying 30 bytes from a string of length 255 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: warning: ‘strncpy’ output may be truncated copying 30 bytes from a string of length 255 [-Wstringop-truncation]
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  reports.c
reports.c: In function ‘print_the_system_summary’:
reports.c:283:20: warning: type defaults to ‘int’ in declaration of ‘idx’ [-Wimplicit-int]
  283 |           register idx;
      |                    ^~~
reports.c: In function ‘time_to_string’:
reports.c:53:32: warning: ‘%02d’ directive writing between 2 and 11 bytes into a region of size between 0 and 3 [-Wformat-overflow=]
   53 |   sprintf (str, "%4d:%02d:%02d.%02d",
      |                                ^~~~
In file included from /usr/include/stdio.h:866,
                 from tua.h:80,
                 from reports.c:23:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:38:10: note: ‘__sprintf_chk’ output between 14 and 32 bytes into a destination of size 14
   38 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   40 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  sysalias.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  systree.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  tmparse.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  trees.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  tua.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  useralias.c
gcc -c -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -DLIBDIR=\"/etc\" -I. -I.. -I../intl -I../intl -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall  usertree.c
gcc -flto=auto -ffat-lto-objects -Wl,-z,relro -o tua globalias.o wildmat.o commtree.o compat.o daytree.o debug.o julian.o pcdl.o pcdl_gram.o phonesw.o portalias.o porttree.o process.o prochist.o reports.o sysalias.o systree.o tmparse.o trees.o tua.o useralias.o usertree.o libtua.a
/usr/bin/ld: /tmp/cctBepsp.ltrans0.ltrans.o: in function `read_log_log':
/<<PKGBUILDDIR>>/src/taylor/log.c:77: undefined reference to `strbegcmp'
/usr/bin/ld: /tmp/cctBepsp.ltrans0.ltrans.o:/<<PKGBUILDDIR>>/src/taylor/log.c:85: undefined reference to `strbegcmp'
/usr/bin/ld: /tmp/cctBepsp.ltrans0.ltrans.o: in function `read_log_log':
/<<PKGBUILDDIR>>/src/taylor/proclog.c:170: undefined reference to `strbegcmp'
/usr/bin/ld: /tmp/cctBepsp.ltrans0.ltrans.o:/<<PKGBUILDDIR>>/src/taylor/proclog.c:189: undefined reference to `strbegcmp'
/usr/bin/ld: /tmp/cctBepsp.ltrans0.ltrans.o:/<<PKGBUILDDIR>>/src/taylor/log.c:95: undefined reference to `strbegcmp'
/usr/bin/ld: /tmp/cctBepsp.ltrans0.ltrans.o:/<<PKGBUILDDIR>>/src/taylor/proclog.c:152: more undefined references to `strbegcmp' follow
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:105: tua] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>/src'
make[1]: *** [Makefile:45: all] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:15: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2