Open reinerh opened 4 months ago
we enable most warnings and set as error in order to be more strict. Is this something that can be fixed upstream in tinydir? Are its functions too big to inline?
I just compared the build flags between Debian and Ubuntu and found that the difference that causes the problem is -D_FORTIFY_SOURCE=
. In Debian that is set to 2 and in Ubuntu to 3.
When I change it in the Debian build to 3, I get the same error.
I guess that with a better fortification the code is also getting a bit larger and it reaches the inlining instructions limit.
It probably should be addressed in tinydir upstream. For the cdogs-sdl package, I'll check if I can raise the limit.
When I raise the inlining limit (-finline-limit=1000
), the build continues but fails later with:
src/cdogs/utils.c: In function ‘RelPathFromCWD’:
src/cdogs/utils.c:152:17: error: ‘__builtin___strncat_chk’ output may be truncated copying 4095 bytes from a string of length 4095 [-Werror=stringop-truncation]
152 | strncat(srcBuf, src, CDOGS_PATH_MAX - 1);
| ^
src/cdogs/utils.c: In function ‘GetDataFilePath’:
src/cdogs/utils.c:152:17: error: ‘__builtin___strncat_chk’ output may be truncated copying 4095 bytes from a string of length 4095 [-Werror=stringop-truncation]
(this check also seems to come from -D_FORTIFY_SOURCE=3
)
When I ignore that with -Wno-stringop-truncation
the build succeeds.
Nix is disabling fortifying with level 3:
Gentoo, FreeBSD and OpenMandriva are patching out -Werror
:
https://gitweb.gentoo.org/repo/gentoo.git/tree/games-arcade/cdogs-sdl/files/cdogs-sdl-1.1.1-cmake.patch
https://cgit.freebsd.org/ports/tree/games/cdogs-sdl/files/patch-CMakeLists.txt
https://github.com/OpenMandrivaAssociation/cdogs-sdl/blob/master/cdogs-sdl-disable-werror.patch
which version of ubuntu/gcc runs into this error?
Yes, 13.2.0, same on Debian unstable.
After increasing the inline limit and ignoring stringop-truncation errors in the 2.0.0 Debian package, it also successfully built in Ubuntu and it made it just in time before the freeze for 24.04 LTS. :smile:
On Ubuntu build servers the build fails with this error:
In CMakeLists.txt
-Werror
and-Winline
are set: https://github.com/cxong/cdogs-sdl/blob/92490cc1e30faf0178d6dea1857a2b653ffb0caf/CMakeLists.txt#L131tinydir_open
is declared as:where
_TINYDIR_FUNC
is:I'm not sure why it fails on Ubuntu, but succeeds on Debian builds (and also on CI builds here on Github). (maybe related to
--param max-inline-insns-single limit reached
that could be different?)Is there a reason why the build explicitely sets
-Winline
and upgrades these warnings to errors?