mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.73k stars 794 forks source link

Problem building under Serenity #1592

Closed danboid closed 4 years ago

danboid commented 4 years ago

mgba seems to be quite portable so I tried to build 0.8b1 for Serenity ( https://github.com/SerenityOS/serenity ) but, after disabling opengl and dynlibs, I've only been able to get this far:

[ 55%] Building C object CMakeFiles/mgba.dir/src/gba/renderers/software-mode0.c.o
In file included from /home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/debugger/debugger.h:14,
                 from /home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/core.h:22,
                 from /home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/internal/gba/renderers/video-software.h:13,
                 from /home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-private.h:10,
                 from /home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:6:
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c: In function 'GBAVideoSoftwareRendererDrawBackgroundMode0':
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:520:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, NoBlend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:520:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, NoBlend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:522:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, NoBlend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:522:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, NoBlend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:526:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, Blend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:526:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, Blend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:528:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, Blend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:528:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, Blend, NO_OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:534:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, NoBlend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:534:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, NoBlend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:536:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, NoBlend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:536:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, NoBlend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:540:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, Blend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:540:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(16, Blend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:78: error: expected ')' before 'PRIXPTR'
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                                                                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:542:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, Blend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:441:26: warning: spurious trailing '%' in format [-Wformat=]
   mLOG(GBA_VIDEO, FATAL, "Background draw ended in the wrong place! Diff: %" PRIXPTR, &renderer->row[outX] - pixel); \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/include/mgba/core/log.h:59:81: note: in definition of macro 'mLOG'
 #define mLOG(CATEGORY, LEVEL, ...) mLog(_mLOG_CAT_ ## CATEGORY, mLOG_ ## LEVEL, __VA_ARGS__)
                                                                                 ^~~~~~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/gba/renderers/software-mode0.c:542:5: note: in expansion of macro 'DRAW_BACKGROUND_MODE_0'
     DRAW_BACKGROUND_MODE_0(256, Blend, OBJWIN);
     ^~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/mgba.dir/build.make:1574: recipe for target 'CMakeFiles/mgba.dir/src/gba/renderers/software-mode0.c.o' failed
make[2]: *** [CMakeFiles/mgba.dir/src/gba/renderers/software-mode0.c.o] Error 1
CMakeFiles/Makefile2:69: recipe for target 'CMakeFiles/mgba.dir/all' failed
make[1]: *** [CMakeFiles/mgba.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

Any suggestions?

endrift commented 4 years ago

Looks like the compiler doesn't define PRIXPTR. This is a problem with the compiler, but it can be worked around.

danboid commented 4 years ago

I have submitted a PR to add PRIXPTR to serenity's LibC.

However, the problem now is that mman.h is just a stub under Serenity and so MS_SYNC is undefined:

[ 69%] Building C object CMakeFiles/mgba.dir/src/util/vfs/vfs-fd.c.o
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/util/vfs/vfs-fd.c: In function '_vfdSync':
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/util/vfs/vfs-fd.c:172:2: warning: implicit declaration of function 'futimes'; did you mean 'ctime'? [-Wimplicit-function-declaration]
  futimes(vfd->fd, NULL);
  ^~~~~~~
  ctime
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/util/vfs/vfs-fd.c:175:10: warning: implicit declaration of function 'msync'; did you mean 'sync'? [-Wimplicit-function-declaration]
   return msync(buffer, size, MS_SYNC) == 0;
          ^~~~~
          sync
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/util/vfs/vfs-fd.c:175:30: error: 'MS_SYNC' undeclared (first use in this function)
   return msync(buffer, size, MS_SYNC) == 0;
                              ^~~~~~~
/home/local/ISDADS/sgs548/src/serenity/Ports/mgba/mgba-0.8-b1/src/util/vfs/vfs-fd.c:175:30: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/mgba.dir/build.make:2318: recipe for target 'CMakeFiles/mgba.dir/src/util/vfs/vfs-fd.c.o' failed
make[2]: *** [CMakeFiles/mgba.dir/src/util/vfs/vfs-fd.c.o] Error 1
CMakeFiles/Makefile2:69: recipe for target 'CMakeFiles/mgba.dir/all' failed
make[1]: *** [CMakeFiles/mgba.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
danboid commented 4 years ago

Here is the replacement issue and an updated mgba serenity ports script:

https://github.com/SerenityOS/serenity/issues/865