FULL ERROR MESSAGE
When executed command sudo dpkg-buildpackage to compile dump1090-fa, got following error message:
interactive.c:334:49: error: ‘%5d’ directive output may be truncated writing between 5 and 11 bytes into a region of size 7 [-Werror=format-truncation=]
334 | snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100));
| ^~~
interactive.c:334:48: note: directive argument in the range [-2147483648, 2147483644]
334 | snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100));
| ^~~~~~
In file included from /usr/include/stdio.h:974,
from dump1090.h:64,
from interactive.c:50:
In function ‘snprintf’,
inlined from ‘interactiveShowData’ at interactive.c:334:17:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: note: ‘__builtin___snprintf_chk’ output between 7 and 13 bytes into a destination of size 7
68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:206: interactive.o] Error 1
make[2]: Leaving directory '/home/abcd/dump1090/package-trixie'
dh_auto_build: error: make -j1 INSTALL="install --strip-program=true" ARCH=amd64 RTLSDR=yes BLADERF=yes HACKRF=yes LIMESDR=yes SOAPYSDR=yes DUMP1090_VERSION=11.1 returned exit code 2
make[1]: *** [debian/rules:54: override_dh_auto_build] Error 2
make[1]: Leaving directory '/home/abcd/dump1090/package-trixie'
make: *** [debian/rules:69: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
[ERROR] Error in line 130 when executing: dpkg-buildpackage -b --no-sign
abcd@debian-14:~$
ANALYSIS
The error is caused by GCC ver 16 which is very strict.
The build fails because strFl is hardcoded as an array of 7 bytes, but a large negative or positive integer passed to "%5d"
bytes into a region of size 7 [-Werror=format-truncation=]
334 | snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100));
In file dump1090/interactive.c
190 char strFl[7] = " ";
329 char strFl[7] = " ";
334 snprintf(strFl, sizeof(strFl), "%5d ", convert_altitude(modeC * 100));
SOLUTION
IMMEDIATELY AFTER cloning source code of dump1090, and BEFORE running command sudo ./prepare-build.sh, issue following command
sudo sed -i 's/char strFl\[7\]/char strFl[16]/g' dump1090/interactive.c
The above command will modify the hard-coded size of strFl from 7 bytes to 16 bytes. Tested and found 16 bytes is large enough to stop error., and dump1090-fa compiled successfully.
