mamedev / mame

MAME
https://www.mamedev.org/
Other
7.75k stars 1.95k forks source link

[Android] Fail to compile msxdos2.cpp: expected member name or ';' after declaration specifiers #12479

Closed FlykeSpice closed 2 weeks ago

FlykeSpice commented 2 weeks ago

MAME version

85624c486db19493fbbb87c091ca1a77559651d5

System information

Cross-compiling to Android

INI configuration details

No response

Emulated system/software

msxdos2

Incorrect behaviour

I'm trying to cross-compile mame (latest git head commit) to Android so I can contribute to Mame4Droid, because Mame4Droid author doesn't provides the build scripts or instructions necessary to build the core I had to make them myself.

My buildscripts do nothing than setup the build system to use mame4droid OSD on android target, I managed to sucessfully compile(and run) SUBTARGET=tiny and now I'm trying to compile the mame one.

However after long hours it failed on this exact spot:

../../../../../src/devices/bus/msx/cart/msxdos2.cpp:42:35: error: expected member name or ';' after declaration specifiers static inline constexpr unsigned PAGE_SIZE = 0x4000;


In file included from ../../../../../src/devices/bus/msx/cart/msxdos2.cpp:1:
In file included from /home/flyke/mame/build/projects/mame4droid/mame/gmake-android-arm64/../../../../../src/emu/emu.h:24:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/list:198:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__memory/allocator.h:23:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/stdexcept:48:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/iosfwd:100:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__mbstate_t.h:29:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/wchar.h:124:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/wchar.h:37:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/time.h:37:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/time.h:37:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/select.h:40:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/signal.h:41:
In file included from /home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/ucontext.h:34:
/home/flyke/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/user.h:37:19: note: expanded from macro 'PAGE_SIZE'
#define PAGE_SIZE 4096
                  ^
Compiling src/devices/bus/msx/cart/nomapper.cpp...
1 error generated.
make[2]: *** [optional.make:22910: ../../../../android/obj/arm64/Release/src/devices/bus/msx/cart/msxdos2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:91: optional] Error 2
make: *** [makefile:1236: android-arm64] Error 2

### Expected behaviour

It should compile normally.

### Steps to reproduce

_No response_

### Additional details

_No response_
FlykeSpice commented 2 weeks ago

Adding '#undef PAGE_SIZE' right after the headers fixes the issue

pmackinlay commented 2 weeks ago

The /usr/include/sys/user.h header states it's only supposed to be used by/for GDB, so it probably shouldn't be being included here. I think you need to track down where/why it's being included and stop that from happening, because PAGE_SIZE shouldn't be leaking into MAME drivers. It's quite conceivable such a generic identifier might be used elsewhere, and requiring general MAME code to avoid it is wrong.

rb6502 commented 2 weeks ago

Also, if you're taking hours to compile MAME, you need to use -j (number of cores on your system). -j16 for a 16-core system, for instance.