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

Enable compilation on Fedora 41 on aarch64 #526

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

pstef
Copy link

@pstef pstef commented Mar 19, 2024

This gets rid of two compilation errors I was getting with the bundled zlib and minizip libraries, and one compilation error in libretro.c.

pstef added 3 commits March 19, 2024 21:17
Trying to compile this libretro core on my Fedora aarch64 machine
I was getting this error:

mupen64plus-core/subprojects/minizip/zip.c:1249:28:
error: assignment to
‘const long unsigned int *’ from incompatible pointer type
‘const uint32_t *’ {aka ‘const unsigned int *’}
[-Wincompatible-pointer-types]
 1249 |         zi->ci.pcrc_32_tab = get_crc_table();
      |                            ^
(redacted for clarity in this commit message)

Curiously, mupen64plus-core having the same minizip code didn't
suffer from this error. This is because there the problematic code
has been disabled by using exclusion defines NOCRYPT and NOUNCRYPT.

This commit tries to do the same for this repository.
Trying to compile this libretro core on my Fedora aarch64 machine
I was getting:

libretro/libretro.c:722:61: error:
passing argument 2 of ‘co_create’ from incompatible pointer type
[-Wincompatible-pointer-types]
  game_thread = co_create(65536 * sizeof(void*) * 16, EmuThreadFunction);
(redacted for clarity in this commit message)

The problem is that co_create() and pthread_create() are different
APIs. While the former expects a void (*)(void), the latter expects
a void * (*)(void *).

This commit
 * redefines EmuThreadFunction so that it matches co_create()
   where it's used, and
 * creates a new wrapping function EmuThreadWrapper matching
   the function type expected by pthread_create(), where it's used.
On my system it was missing the inclusion of unistd.h. Mimic what's
been done for MacOSX and conditionally add -DHAVE_UNISTD_H for this
library.
@m4xw
Copy link
Collaborator

m4xw commented Apr 11, 2024

Hi, sorry missed this PR. I will check it out by next week. I could swear i had some of the type missmatch stuff fixed before i cant remember where it went...
Is this for you personal or for distribution on the package manager?
I think the zip libs are fair to use the distribution but just for the record i highly recommend using the bundled libpng, historically that caused too much issues.

@pstef
Copy link
Author

pstef commented Apr 11, 2024

I did this for my personal use and I thought I'd share.

@pstef
Copy link
Author

pstef commented Jul 9, 2024

This is starting to conflict with other people's commits.

@m4xw
Copy link
Collaborator

m4xw commented Jul 15, 2024

This is starting to conflict with other people's commits.

Well yours already conflicts with my changes too ;)

@@ -175,6 +176,9 @@ ifeq ($(SYSTEM_ZLIB), 1)
CFLAGS += $(shell pkg-config --cflags zlib)
LDFLAGS += $(shell pkg-config --libs zlib)
else
ifneq (,$(findstring unix,$(platform)))
PLATCFLAGS += -DHAVE_UNISTD_H
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it custom/dependencies/libzlib/zconf.h doesn't include unistd.h and compilation fails on unknown functions read(), close(), write().

I don't insist on this solution, but something is needed to remedy this issue.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm how didnt this blow before? Did it link implicitly? Not sure if large file support would be more appropriate.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. It's not something I have tested previous versions against.

Copy link
Author

@pstef pstef Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just compiled this core on a Debian Trixie, which is a testing release but not as experimental as Fedora Rawhide is. The GCC version here is 13 as opposed to GCC 14 in Rawhide. The implicit declarations are reported by GCC 13 as well, but only as warnings. Most likely this warning has been promoted to an error somewhere on the way to GCC 14.1.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m4xw
Copy link
Collaborator

m4xw commented Jul 30, 2024

Can you try if fpermissive in cflags also works?

@pstef
Copy link
Author

pstef commented Jul 30, 2024

I'm already using this patch and whether you take it or not will have to be your choice and responsibility, not mine.

@pstef pstef mentioned this pull request Aug 14, 2024
@m4xw
Copy link
Collaborator

m4xw commented Oct 24, 2024

Btw i have been reproducing this with emscripten so will get that in after my update round

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

Successfully merging this pull request may close these issues.

2 participants