KallistiOS / kos-ports

Ported library collection for KallistiOS
Other
55 stars 35 forks source link

GCC 14: libjimtcl, libmp3, liboggvorbisplay, libtremor will no longer build #54

Closed darcagn closed 5 months ago

darcagn commented 8 months ago

-Wimplicit-function-declaration will be made into an error on GCC 14 when released: https://github.com/gcc-mirror/gcc/commit/55e94561e97ed0bce4774aa1c6b5d5d82209a379

This breaks four kos-ports.

Need to fix:

libjimtcl:

jim-file.c: In function ‘file_lstat’:
./jimiocompat.h:90:34: error: implicit declaration of function ‘lstat’; did you mean ‘stat’? [-Wimplicit-function-declaration]
   90 |             #define Jim_LinkStat lstat
      |                                  ^~~~~
jim-file.c:708:9: note: in expansion of macro ‘Jim_LinkStat’
  708 |     if (Jim_LinkStat(path, sb) == -1) {
      |         ^~~~~~~~~~~~

libmp3:

main.c: In function ‘sndserver_thread’:
main.c:14:9: error: implicit declaration of function ‘sndmp3_mainloop’ [-Wimplicit-function-declaration]
   14 |         sndmp3_mainloop();
      |         ^~~~~~~~~~~~~~~
main.c: In function ‘mp3_init’:
main.c:24:17: error: implicit declaration of function ‘sndmp3_wait_start’ [-Wimplicit-function-declaration]
   24 |                 sndmp3_wait_start();
      |                 ^~~~~~~~~~~~~~~~~
main.c: In function ‘mp3_start’:
main.c:31:16: error: implicit declaration of function ‘sndmp3_start’; did you mean ‘mp3_start’? [-Wimplicit-function-declaration]
   31 |         return sndmp3_start(fn, loop);
      |                ^~~~~~~~~~~~
      |                mp3_start
main.c: In function ‘mp3_stop’:
main.c:35:9: error: implicit declaration of function ‘sndmp3_stop’; did you mean ‘mp3_stop’? [-Wimplicit-function-declaration]
   35 |         sndmp3_stop();
      |         ^~~~~~~~~~~
      |         mp3_stop
main.c: In function ‘mp3_shutdown’:
main.c:40:9: error: implicit declaration of function ‘sndmp3_shutdown’; did you mean ‘mp3_shutdown’? [-Wimplicit-function-declaration]
   40 |         sndmp3_shutdown();
      |         ^~~~~~~~~~~~~~~
      |         mp3_shutdown
main.c: In function ‘mp3_volume’:
main.c:45:8: error: implicit declaration of function ‘sndmp3_volume’; did you mean ‘mp3_volume’? [-Wimplicit-function-declaration]
   45 |        sndmp3_volume(vol);
      |        ^~~~~~~~~~~~~
      |        mp3_volume

liboggvorbisplay:

liboggvorbisplay/main.c: In function ‘sndserver_thread’:
liboggvorbisplay/main.c:7:9: error: implicit declaration of function ‘sndoggvorbis_mainloop’ [-Wimplicit-function-declaration]
    7 |         sndoggvorbis_mainloop();
      |         ^~~~~~~~~~~~~~~~~~~~~
liboggvorbisplay/main.c: In function ‘sndoggvorbis_init’:
liboggvorbisplay/main.c:24:17: error: implicit declaration of function ‘sndoggvorbis_wait_start’; did you mean ‘sndoggvorbis_init’? [-Wimplicit-function-declaration]
   24 |                 sndoggvorbis_wait_start();
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
      |                 sndoggvorbis_init

libtremor:

main.c: In function ‘sndserver_thread’:
main.c:7:9: error: implicit declaration of function ‘sndoggvorbis_mainloop’ [-Wimplicit-function-declaration]
    7 |         sndoggvorbis_mainloop();
      |         ^~~~~~~~~~~~~~~~~~~~~
main.c: In function ‘sndoggvorbis_init’:
main.c:24:17: error: implicit declaration of function ‘sndoggvorbis_wait_start’; did you mean ‘sndoggvorbis_init’? [-Wimplicit-function-declaration]
   24 |                 sndoggvorbis_wait_start();
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
      |                 sndoggvorbis_init
andressbarajas commented 5 months ago

I logged an issue upstream for jimtcl: https://github.com/msteveb/jimtcl/issues/303

andressbarajas commented 5 months ago

@darcagn He created a branch for us in his repo "kos-fixes" that fixs the compile warning. Not sure if we want to update our makefile to point to that branch or try and convince him to merge that kos fix into his master.

darcagn commented 5 months ago

Based on his commit message I think he wants it to be tested to make sure it works/makes sense before committing to master.

Some of these (like missing getpeername) are reasonable, but
it seems like an odd platform that declares but doesn't implement
access and umask, and implements but doesn't declare lstat.

These changes need testing to see if enough works to be useful.

But he raises a good point. We implement lstat(): https://github.com/KallistiOS/KallistiOS/blob/b51c6aa33c13fa0b68f6485e06108bf19c53d812/kernel/libc/newlib/newlib_stat.c#L59

But it's not declared anywhere so libjimtcl can't access it. It seems like the right path here would be to declare lstat() somewhere.

darcagn commented 5 months ago

This is now solved pending the merge of PR KallistiOS/KallistiOS#530. By altering the Newlib headers, lstat() is declared and libjimtcl builds without complaint. All of kos-ports now builds under GCC 14/15! Thanks very much for your assistance on these issues @QuzarDC and @andressbarajas -- GCC 14 rc1 should be coming this Tuesday and KOS is now prepared to support it without issue!