Trying to compile Mednafen

Hello. I’m trying to compile a recent version of Mednafen (1.21). The configure script ends without issue, but when compile the source, I get this error:

depbase=echo net/Net_POSIX.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';
g++ -std=gnu++11 -fsigned-char -DHAVE_CONFIG_H - I/packages/libsndfile_x86-1.0.28-1/.self/develop/headers/x86 -I…/include -I…/include -I…/intl -fno-fast-math -fno-unsafe-math-optimizations -fno-aggressive-loop-optimizations -fno-ipa-icf -fno-printf-return-value -fomit-frame-pointer -fstrict-aliasing -Wall -Wshadow -Wempty-body -Wignored-qualifiers -Wvla -Wvariadic-macros -Wdisabled-optimization -fno-pic -fno-pie -fno-PIC -fno-PIE -no-pie -fwrapv -fjump-tables -mfunction-return=keep -mindirect-branch=keep -mno-indirect-branch-register -fexceptions -g -O2 -MT net/Net_POSIX.o -MD -MP -MF $depbase.Tpo -c -o net/Net_POSIX.o net/Net_POSIX.cpp &&
mv -f $depbase.Tpo $depbase.Po
In file included from /boot/system/develop/headers/os/support/ByteOrder.h:11,
from /boot/system/develop/headers/bsd/endian.h:16,
from /boot/system/develop/headers/posix/netinet/in.h:10,
from net/Net_POSIX.cpp:28:
/boot/system/develop/headers/os/support/SupportDefs.h:24:25: error: conflicting declaration ‘typedef __haiku_int32 int32’
typedef __haiku_int32 int32;
^~~~~
In file included from …/include/mednafen/mednafen.h:4,
from net/Net.h:25,
from net/Net_POSIX.h:4,
from net/Net_POSIX.cpp:22:
…/include/mednafen/types.h:68:17: note: previous declaration as ‘typedef int32_t int32’
typedef int32_t int32;
^~~~~
In file included from /boot/system/develop/headers/os/support/ByteOrder.h:11,
from /boot/system/develop/headers/bsd/endian.h:16,
from /boot/system/develop/headers/posix/netinet/in.h:10,
from net/Net_POSIX.cpp:28:
/boot/system/develop/headers/os/support/SupportDefs.h:25:26: error: conflicting declaration ‘typedef __haiku_uint32 uint32’
typedef __haiku_uint32 uint32;
^~~~~~
In file included from …/include/mednafen/mednafen.h:4,
from net/Net.h:25,
from net/Net_POSIX.h:4,
from net/Net_POSIX.cpp:22:
…/include/mednafen/types.h:73:18: note: previous declaration as ‘typedef uint32_t uint32’
typedef uint32_t uint32;
^~~~~~
Makefile:4119: recipe for target ‘net/Net_POSIX.o’ failed
make[2]: *** [net/Net_POSIX.o] Error 1
make[2]: Leaving directory ‘/boot/home/Compilar/mednafen/src’
Makefile:4855: recipe for target ‘all-recursive’ failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory ‘/boot/home/Compilar/mednafen/src’
Makefile:472: recipe for target ‘all-recursive’ failed
make: *** [all-recursive] Error 1
[x86] ~/Compilar/mednafen>

There is an issue with POSIX compatibility?

I also tried the mednafen recipe from HaikuPorts, but that is an old one, and anyways appears to be broken too.

1 Like

Both Haiku and Mednafen try to define a type called int32 (which is not in POSIX, it’s in BeOS. Posix and modern C use int32_t).

Adding a #ifndef __HAIKU__ around the typedef uint32_t uint32; in include/mednafen/types.h line 73 should fix this (then it will use the already existing int32 definition).

1 Like

There is already a mednafen recipe that does all this, right?

Hi. I check the patches at HaikuPorts, but apparently don’t include the Pulkomandy fix:
https://github.com/haikuports/haikuports/tree/master/app-emulation/mednafen/patches

I guess is because the recipe is for an older version of Mednafen.

Haikuports devs already working on the new PR for Mednafen 1.22.1
See: https://github.com/haikuports/haikuports/pull/3765

1 Like

Thanks for the hint, @cocobean. I didn’t noticed it :+1:

I got 2 weeks long forced vacation, i should finish this recipe.