Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core doesn't build correctly on GNU/Linux #557

Open
vanfanel opened this issue Nov 7, 2024 · 10 comments
Open

Core doesn't build correctly on GNU/Linux #557

vanfanel opened this issue Nov 7, 2024 · 10 comments

Comments

@vanfanel
Copy link

vanfanel commented Nov 7, 2024

Hello there,

I have tried to build latest GIT code today and I get this:

custom/dependencies/libzlib/gzlib.c: In function ‘gz_open’:
custom/dependencies/libzlib/gzlib.c:14:17: error: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
   14 | #  define LSEEK lseek
      |                 ^~~~~
custom/dependencies/libzlib/gzlib.c:256:24: note: in expansion of macro ‘LSEEK’
  256 |         state->start = LSEEK(state->fd, 0, SEEK_CUR);
      |                        ^~~~~
make: *** [Makefile:694: custom/dependencies/libzlib/gzlib.o] Error 1

Was building working fine time ago.

@m4xw
Copy link
Collaborator

m4xw commented Nov 7, 2024

can u check why unistd isnt included for your case?

@vanfanel
Copy link
Author

vanfanel commented Nov 8, 2024

@m4xw I don't quite get the question. It was not included because it was not there.

I had to add #include <unistd.h to custom/dependencies/libzlib/gzlib.c, custom/dependencies/libzlib/gzread.c, and custom/dependencies/libzlib/gzwrite.c.

Still I don't get it, because as you can see the needed header file isn't present in those. The cause would be that.. it's not there :)

I am using gcc version 14.2.0 (Debian 14.2.0-6) on Debian Trixie. Maybe on older GCC or lib versions, unistd was indirectly included on another header or something.

@m4xw
Copy link
Collaborator

m4xw commented Nov 8, 2024

its in zconf.h and gzguts.h so why its not being included for you?

@vanfanel
Copy link
Author

vanfanel commented Nov 8, 2024

It's not in gzguts.h at all, and in zconf.h it's only included if certain conditions are met.

But even so, only gzguts.h is included in custom/dependencies/libzlib/gzlib.c, custom/dependencies/libzlib/gzread.c, and custom/dependencies/libzlib/gzwrite.c, not zconf.h.

@vanfanel
Copy link
Author

vanfanel commented Nov 8, 2024

What's more: in Makefile, -DHAVE_UNISTD_H=1 is only passed for OS X, not GNU/Linux, so the unistd.h inclusion in zconf.h could be compromised on GNU/Linux for the lack of -DHAVE_UNISTD_H=1 I guess.

@m4xw
Copy link
Collaborator

m4xw commented Nov 8, 2024

gzguts includes zlib which includes zconf

gzguts hides it behind emscripten so i guess we encountered it before, in your case it seems that largefile isnt defined and I think the have unistd define should be set via configure which we dont run.

solution is either define Z_HAVE_UNISTD_H via -DZ_HAVE_UNISTD_H or enable largefile support

@m4xw
Copy link
Collaborator

m4xw commented Nov 8, 2024

(or just HAVE_UNISTD_H but that just defines Z_HAVE_UNISTD_H)

@m4xw
Copy link
Collaborator

m4xw commented Nov 8, 2024

I am fine with including -DHAVE_UNISTD_H

What's more: in Makefile, -DHAVE_UNISTD_H=1 is only passed for OS X, not GNU/Linux, so the unistd.h inclusion in zconf.h could be compromised on GNU/Linux for the lack of -DHAVE_UNISTD_H=1 I guess.

Yea i think so far it has been implicitly declared and thats not happy on gcc14

@m4xw
Copy link
Collaborator

m4xw commented Nov 8, 2024

guess both #536 and #526 provide the solution, i will get them in by next week

@thiagoor-cpu
Copy link

Hello, any news about the fix? Im unable to use the emulator in Raspberry Pi 5 64Bits + Retropie, the build fail because of this..

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants