Coder Social home page Coder Social logo

Comments (7)

cxong avatar cxong commented on May 29, 2024

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?

from cdogs-sdl.

reinerh avatar reinerh commented on May 29, 2024

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.

from cdogs-sdl.

reinerh avatar reinerh commented on May 29, 2024

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.

from cdogs-sdl.

reinerh avatar reinerh commented on May 29, 2024

Nix is disabling fortifying with level 3:

https://github.com/NixOS/nixpkgs/blob/5863c27340ba4de8f83e7e3c023b9599c3cb3c80/pkgs/games/cdogs-sdl/default.nix#L53-L54

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

from cdogs-sdl.

cxong avatar cxong commented on May 29, 2024

which version of ubuntu/gcc runs into this error?

  • from build logs, it's ubuntu 20.04 gcc GNU 13.2.0

from cdogs-sdl.

reinerh avatar reinerh commented on May 29, 2024

Yes, 13.2.0, same on Debian unstable.

from cdogs-sdl.

reinerh avatar reinerh commented on May 29, 2024

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. 😄

from cdogs-sdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.