cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
868 stars 115 forks source link

Build failure #792

Open reinerh opened 1 year ago

reinerh commented 1 year ago

Hi,

I tried building cdogs-sdl, but I'm running into a compilation error:

$ cmake .. -DUSE_SHARED_ENET=ON
...
$ make
...
[ 74%] Building C object src/cdogsed/CMakeFiles/cdogsedlib.dir/nk_window.c.o
In file included from /tmp/cdogs-sdl/src/cdogsed/nk_window.c:47:
In function ‘nk_memset’,
    inlined from ‘nk_tt__h_prefilter’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:12315:9,
    inlined from ‘nk_tt_PackFontRangesRenderIntoRects’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:12528:20,
    inlined from ‘nk_font_bake’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:12871:13,
    inlined from ‘nk_font_atlas_bake’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:13770:5:
/tmp/cdogs-sdl/src/nuklear/nuklear.h:6436:20: error: ‘__builtin_memset’ writing between 1 and 3 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 6436 |             *dst++ = (nk_byte)c0;
      |             ~~~~~~~^~~~~~~~~~~~~
/tmp/cdogs-sdl/src/nuklear/nuklear.h: In function ‘nk_font_atlas_bake’:
/tmp/cdogs-sdl/src/nuklear/nuklear.h:12307:19: note: at offset 8 into destination object ‘buffer’ of size 8
12307 |     unsigned char buffer[NK_TT_MAX_OVERSAMPLE];
      |                   ^~~~~~
/tmp/cdogs-sdl/src/nuklear/nuklear.h:12307:19: note: at offset [9, 11] into destination object ‘buffer’ of size 8
In function ‘nk_memset’,
    inlined from ‘nk_tt__v_prefilter’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:12378:9,
    inlined from ‘nk_tt_PackFontRangesRenderIntoRects’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:12532:20,
    inlined from ‘nk_font_bake’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:12871:13,
    inlined from ‘nk_font_atlas_bake’ at /tmp/cdogs-sdl/src/nuklear/nuklear.h:13770:5:
/tmp/cdogs-sdl/src/nuklear/nuklear.h:6436:20: error: ‘__builtin_memset’ writing between 1 and 3 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 6436 |             *dst++ = (nk_byte)c0;
      |             ~~~~~~~^~~~~~~~~~~~~
/tmp/cdogs-sdl/src/nuklear/nuklear.h: In function ‘nk_font_atlas_bake’:
/tmp/cdogs-sdl/src/nuklear/nuklear.h:12370:19: note: at offset 8 into destination object ‘buffer’ of size 8
12370 |     unsigned char buffer[NK_TT_MAX_OVERSAMPLE];
      |                   ^~~~~~
/tmp/cdogs-sdl/src/nuklear/nuklear.h:12370:19: note: at offset [9, 11] into destination object ‘buffer’ of size 8

I'm trying to compile with GCC 12.3.0. The last nuklear update is from 2019. It might have already been fixed in more recent versions.

cxong commented 1 year ago

I have tried a few times in the past to update nuklear to fix compiler warnings but it hasn't worked, nuklear project doesn't aim to fix all warnings with the latest compilers; see their latest master build for example https://github.com/Immediate-Mode-UI/Nuklear/actions/runs/5278673461/jobs/9548325220 It is best to ignore warnings for nuklear for now