LTVA1 / klystrack

A fork of a chiptune tracker, supporting import of FamiTracker, AHX, FastTracker II and Protracker modules
http://kometbomb.github.io/klystrack/
Other
45 stars 2 forks source link

FTBFS with newer GCC versions #5

Open grawlinson opened 1 month ago

grawlinson commented 1 month ago

Hey! Package maintainer for Arch Linux here.

This project fails to build from source because of gcc becoming more strict in newer releases.

Specfically here, error output:

src/gfx/font.c: In function ‘unicode_strdup’:
src/gfx/font.c:38:24: error: passing argument 1 of ‘strlen’ from incompatible pointer type [-Wincompatible-pointer-types]
   38 |   size_t size = strlen(s1) * 4 + 1;
      |                        ^~
      |                        |
      |                        const char32_t * {aka const long unsigned int *}
LTVA1 commented 2 days ago

Damn, I forgot about those Unicode preparations, I should probably comment it all out

LTVA1 commented 2 days ago

Try now, I did ugly hacks to hopefully prevent the warning-error from happening

grawlinson commented 2 days ago

More failures here (Sorry!):

make -C tools/makebundle
Compiling view.c...
make[3]: Entering directory '/build/klystrack-plus/src/klystrack-plus/klystron/tools/makebundle'
cc -o ../bin/makebundle.exe -D_XOPEN_SOURCE makebundle.c -std=c99 -I ../../src `sdl2-config --cflags` -Wall -O3
src/gfx/font.c: In function ‘unicode_strdup’:
src/gfx/font.c:39:24: error: passing argument 1 of ‘strlen’ from incompatible pointer type [-Wincompatible-pointer-types]
   39 |   size_t size = strlen(s1) * 4 + 1;
      |                        ^~
      |                        |
      |                        const char32_t * {aka const long unsigned int *}
In file included from /usr/include/SDL2/SDL_stdinc.h:60,
                 from /usr/include/SDL2/SDL_main.h:25,
                 from /usr/include/SDL2/SDL.h:32,
                 from src/gfx/gfxsurf.h:30,
                 from src/gfx/tiledescriptor.h:31,
                 from src/gfx/font.h:31,
                 from src/gfx/font.c:28:
/usr/include/string.h:407:35: note: expected ‘const char *’ but argument is of type ‘const char32_t *’ {aka ‘const long unsigned int *’}
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
src/gfx/font.c: In function ‘unicode_font_load_inner’:
src/gfx/font.c:422:1: warning: no return statement in function returning non-void [-Wreturn-type]
  422 | }
      | ^
make[2]: *** [Makefile:140: objs.release/gfx_font.o] Error 1
make[2]: *** Waiting for unfinished jobs....
src/snd/cydfm.c: In function ‘get_modulator’:
src/snd/cydfm.c:56:104: warning: passing argument 8 of ‘cyd_osc’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   56 |                 return (Uint64)cyd_osc(CYD_CHN_ENABLE_TRIANGLE, acc & (ACC_LENGTH - 1), 0, 0, 0, 0, 0, cyd) * fm->env_output * (fm->fm_curr_tremolo + 512) / 512 * fm->fm_vol_ksl_mult / WAVE_AMP + WAVE_AMP / 2; //was return (Uint64)cyd_osc(CYD_CHN_ENABLE_TRIANGLE, acc % ACC_LENGTH, 0, 0, 0) * fm->env_output / WAVE_AMP + WAVE_AMP / 2;
      |                                                                                                        ^~~
In file included from src/snd/cydfm.c:4:
src/snd/cydosc.h:6:141: note: expected ‘CydEngine *’ {aka ‘struct CydEngine_t *’} but argument is of type ‘const CydEngine *’ {aka ‘const struct CydEngine_t *’}
    6 | Sint32 cyd_osc(Uint32 flags, Uint32 accumulator, Uint32 pw, Uint32 random, Uint32 lfsr_acc, Uint8 mixmode, Uint8 sine_acc_shift, CydEngine* cyd); //Sint32 cyd_osc(Uint32 flags, Uint32 accumulator, Uint32 pw, Uint32 random, Uint32 lfsr_acc);
      |                                                                                                                                  ~~~~~~~~~~~^~~
src/snd/cydwave.c: In function ‘cyd_wave_get_sample’:
src/snd/cydwave.c:318:1: warning: control reaches end of non-void function [-Wreturn-type]
  318 | }
      | ^
src/snd/cydosc.c: In function ‘cyd_osc’:
src/snd/cydosc.c:1493:1: warning: control reaches end of non-void function [-Wreturn-type]
 1493 | }
      | ^
make[3]: Leaving directory '/build/klystrack-plus/src/klystrack-plus/klystron/tools/makebundle'
src/gui/filebox.c: In function ‘field_view’:
src/gui/filebox.c:501:17: warning: ‘strncat’ output may be truncated copying between 0 and 99 bytes from a string of length 255 [-Wstringop-truncation]
  501 |                 strncat(temp, data.field, my_min(sizeof(temp) - 1, content.w / data.largefont->w));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gui/filebox.c: In function ‘filebox’:
src/gui/filebox.c:652:9: warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
  652 |         strncpy(data.field, buffer, sizeof(data.field));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gui/filebox.c:692:41: warning: ‘strncpy’ specified bound 250 equals destination size [-Wstringop-truncation]
  692 |                                         strncpy(last_picked_file, data.picked_file->name, sizeof(last_picked_file));
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gui/filebox.c:775:57: warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
  775 |                                                         strncpy(data.field, data.files[data.selected_file].name, sizeof(data.field));
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gui/filebox.c:781:57: warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
  781 |                                                         strncpy(data.field, data.files[data.selected_file].name, sizeof(data.field));
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: Leaving directory '/build/klystrack-plus/src/klystrack-plus/klystron'
make[1]: *** [Makefile:78: build] Error 2
make[1]: Leaving directory '/build/klystrack-plus/src/klystrack-plus/klystron'
make: *** [Makefile:167: build] Error 2
LTVA1 commented 2 days ago

Damn, will try to fix later

LTVA1 commented 2 days ago

Em, seems like you forgot to update klystron submodule

grawlinson commented 2 days ago

Yep, that’s on me. I’ll have another look soon.