hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.43k stars 2.19k forks source link

Fails to build retroarch core with gcc-14 #19376

Open Shoegzer opened 4 months ago

Shoegzer commented 4 months ago

Platform

Linux / BSD

Compiler and build tool versions

gcc-14

Operating system version

Linux Mint 22

Build commands used

make -j9

What happens

The following errors appear in the build.log (gcc-13 successfully builds without these errors):

../ext/zlib/gzread.c: In function 'gz_load':
../ext/zlib/gzread.c:30:15: error: implicit declaration of function 'read'; did you mean 'fread'? [-Wimplicit-function-declaration]
   30 |         ret = read(state->fd, buf + *have, len - *have);
      |               ^~~~
      |               fread
../ext/zlib/gzread.c: In function 'gzclose_r':
../ext/zlib/gzread.c:595:11: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
  595 |     ret = close(state->fd);
      |           ^~~~~
      |           pclose
make: *** [Makefile:492: ../ext/zlib/gzread.o] Error 1
make: *** Waiting for unfinished jobs....
../ext/zlib/gzlib.c: In function 'gz_open':
../ext/zlib/gzlib.c:14:17: error: implicit declaration of function 'lseek'; did you mean 'fseek'? [-Wimplicit-function-declaration]
   14 | #  define LSEEK lseek
      |                 ^~~~~
../ext/zlib/gzlib.c:256:24: note: in expansion of macro 'LSEEK'
  256 |         state->start = LSEEK(state->fd, 0, SEEK_CUR);
      |                        ^~~~~
make: *** [Makefile:492: ../ext/zlib/gzlib.o] Error 1
../ext/zlib/gzwrite.c: In function 'gz_comp':
../ext/zlib/gzwrite.c:84:15: error: implicit declaration of function 'write'; did you mean 'fwrite'? [-Wimplicit-function-declaration]
   84 |         got = write(state->fd, strm->next_in, strm->avail_in);
      |               ^~~~~
      |               fwrite
../ext/zlib/gzwrite.c: In function 'gzclose_w':
../ext/zlib/gzwrite.c:573:9: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
  573 |     if (close(state->fd) == -1)
      |         ^~~~~
      |         pclose
make: *** [Makefile:492: ../ext/zlib/gzwrite.o] Error 1

PPSSPP version affected

52cf10274c342c1dd97d91c273b109d5c859d227

Last working version

No response

Checklist

hrydgard commented 4 months ago

That's normally just a warning (in a dependency), which seems to have been upgraded to an error for some reason. Did you build with -Werror?

Shoegzer commented 4 months ago

Thanks. I haven't yet, and I can do that, but does this help explain the issue anyway?

anr2me commented 4 months ago

Thanks. I haven't yet, and I can do that, but does this help explain the issue anyway?

I heard they're changing some warnings into errors in GCC 14. May be just need -D_DEFAULT_SOURCE as mentioned in that Porting to GCC 14 page?

To address this, the -std=c11 option can be dropped, -std=gnu11 can be used instead, or -std=c11 -D_DEFAULT_SOURCE can be used re-enable common extensions. Alternatively, projects using Autoconf could enable AC_USE_SYSTEM_EXTENSIONS.