danoon2 / Boxedwine

Emulator that can run 32-bit Windows programs/games on multiple platforms via Wine
GNU General Public License v2.0
816 stars 67 forks source link

build error in x64Asm.cpp using gcc-13.2.0 #92

Closed aqrit closed 6 months ago

aqrit commented 9 months ago
/home/user/Desktop/Boxedwine-master/source/emulation/cpu/x64/x64Asm.cpp: In member function ‘void X64Asm::lsl(bool, unsigned char)’:
/home/user/Desktop/Boxedwine-master/source/emulation/cpu/x64/x64Asm.cpp:15:29: error: ‘rm’ is not a constant expression
   15 | #define G(rm) ((rm >> 3) & 7)
      |                             ^
/home/user/Desktop/Boxedwine-master/source/emulation/cpu/x64/x64Asm.cpp:3401:95: note: in expansion of macro ‘G’
 3401 |     writeToRegFromMem(G(rm), false, HOST_CPU, true, -1, false, 0, (U32)(offsetof(CPU, reg[G(rm)].u32)), 4, false);
      |                                                                                           ^

/home/user/Desktop/Boxedwine-master/source/emulation/cpu/x64/x64Asm.cpp: In member function ‘void X64Asm::lar(bool, unsigned char)’:
/home/user/Desktop/Boxedwine-master/source/emulation/cpu/x64/x64Asm.cpp:15:29: error: ‘rm’ is not a constant expression
   15 | #define G(rm) ((rm >> 3) & 7)
      |                             ^
/home/user/Desktop/Boxedwine-master/source/emulation/cpu/x64/x64Asm.cpp:3446:95: note: in expansion of macro ‘G’
 3446 |     writeToRegFromMem(G(rm), false, HOST_CPU, true, -1, false, 0, (U32)(offsetof(CPU, reg[G(rm)].u32)), 4, false);
      |      

Tried to build on Linux using gcc-11 and gcc-13.

A possible work-around might be:

-       offsetof(CPU, reg[G(rm)].u32
+       offsetof(CPU, reg[0].u32) + (G(rm) * sizeof(Reg))
danoon2 commented 9 months ago

@aqrit Thanks for the report. It's funny timing because I just fixed this in a branch last week.

The soft_mmu branch requires gcc 12 or higher

https://github.com/danoon2/Boxedwine/blob/james/soft_mmu/BUILD.md

I'm not sure when this will go into master, hopefully in the next week or two. It was a pretty big change to refactor how the emulated memory was handled. It will be more correct, but currently I'm working through some performance issues and I imagine I broke 3d(opengl) too. Since I was refactoring so much of the code for this memory change, I decided to update Boxedwine to support c++ 20, which is why gcc 12 or higher will now be required.