#1015417 gngb: ftbfs with LTO (link time optimization) enabled

#1015417#5
Date:
2022-07-19 16:52:33 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/gngb_20060309-5_unstable_dpkglto.log
The last lines of the build log are at the end of this report.

[...]
  174 |     dd=((rom_timer->reg[5]&0x01)<<9)|rom_timer->reg[4];
      |          ~~~~~~~~~~~~~~^~~
In file included from save.c:3:
rom.h:51:9: note: while referencing ‘reg’
   51 |   Uint8 reg[5];
      |         ^~~
save.c:179:24: warning: array subscript 5 is above array bounds of ‘Uint8[5]’ [-Warray-bounds]
  179 |       rom_timer->reg[5]|=0x80;        // set carry
      |       ~~~~~~~~~~~~~~~~~^~~~~~
In file included from save.c:3:
rom.h:51:9: note: while referencing ‘reg’
   51 |   Uint8 reg[5];
      |         ^~~
save.c:183:38: warning: array subscript 5 is above array bounds of ‘Uint8[5]’ [-Warray-bounds]
  183 |     rom_timer->reg[5]=(rom_timer->reg[5]&0xfe)|((dd&0x100)>>9);
      |                        ~~~~~~~~~~~~~~^~~
In file included from save.c:3:
rom.h:51:9: note: while referencing ‘reg’
   51 |   Uint8 reg[5];
      |         ^~~
save.c:183:19: warning: array subscript 5 is above array bounds of ‘Uint8[5]’ [-Warray-bounds]
  183 |     rom_timer->reg[5]=(rom_timer->reg[5]&0xfe)|((dd&0x100)>>9);
      |     ~~~~~~~~~~~~~~^~~
In file included from save.c:3:
rom.h:51:9: note: while referencing ‘reg’
   51 |   Uint8 reg[5];
      |         ^~~
gcc  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -DSDL_YUV -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DSDL_GL  -O3  -Wno-unused -funroll-loops -fstrength-reduce                           -ffast-math -falign-functions=2 -falign-jumps=2                           -falign-loops=2 -fomit-frame-pointer -Wall   -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -o gngb cpu.o emu.o frame_skip.o interrupt.o main.o memory.o message.o rom.o serial.o sgb.o sound.o vram.o video_yuy2.o video_yuv.o video_yv12.o video_std.o video_gl.o menu.o fileio.o save.o unzip.o  -lz -lSDL -lpthread  -L/usr/lib/x86_64-linux-gnu -lSDL -lGL
memory.c:819:12: warning: type of ‘movie_get_next_pad’ does not match original declaration [-Wlto-type-mismatch]
  819 |     gb_pad=movie_get_next_pad();
      |            ^
save.c:679:7: note: return value type mismatch
  679 | Uint8 movie_get_next_pad(void) {
      |       ^
save.c:679:7: note: type ‘Uint8’ should match type ‘int’
save.c:679:7: note: ‘movie_get_next_pad’ was previously declared here
cpu.c:2913:24: warning: type of ‘gbserial_read’ does not match original declaration [-Wlto-type-mismatch]
 2913 |                     SB=gbserial_read();
      |                        ^
serial.c:308:7: note: return value type mismatch
  308 | Uint8 gbserial_read(void) {
      |       ^
serial.c:308:7: note: type ‘Uint8’ should match type ‘int’
serial.c:308:7: note: ‘gbserial_read’ was previously declared here
In function ‘load_rom_timer’,
    inlined from ‘open_rom’ at rom.c:234:27:
save.c:179:24: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  179 |       rom_timer->reg[5]|=0x80;        // set carry
      |                        ^
rom.c: In function ‘open_rom’:
rom.h:51:9: note: at offset 5 into destination object ‘reg’ of size 5
   51 |   Uint8 reg[5];
      |         ^
In function ‘read’,
    inlined from ‘gbserial_read’ at serial.c:312:8:
/usr/include/x86_64-linux-gnu/bits/unistd.h:44:16: warning: call to ‘__read_chk_warn’ declared with attribute warning: read called with bigger length than size of the destination buffer [-Wattribute-warning]
   44 |         return __read_chk_warn (__fd, __buf, __nbytes,
      |                ^
/usr/bin/ld: /tmp/cc8JwmoW.ltrans0.ltrans.o: in function `cpu_run':
./src/cpu.c:2899: undefined reference to `rom_timer_inc'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:347: gngb] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/src'
make[2]: *** [Makefile:430: all-recursive] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
make[1]: *** [Makefile:328: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j8 returned exit code 2
make: *** [debian/rules:6: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

#1015417#14
Date:
2024-11-12 21:47:22 UTC
From:
To:
Hi,

Here is a patch that should solve this issue.

Regards,
Patrice

#1015417#21
Date:
2026-09-22 10:54:50 UTC
From:
To:
Dear submitter,

as the package gngb has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1148695

The version of this package that was in Debian prior to this removal
can still be found using https://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)