XenonRecomp icon indicating copy to clipboard operation
XenonRecomp copied to clipboard

Compilation problem on XenomRecomp's output with Clang++

Open zeerowiibu opened this issue 9 months ago • 2 comments

I don't know if I'm supposed to be doing this, but right now I'm trying to compile cpp files into .exe with MSYS2 CLANG64, then I got hit with these three specific errors:

In file included from ppc_func_mapping.cpp:1:
In file included from ./ppc_recomp_shared.h:4:
./ppc_context.h:676:17: error: non-constexpr declaration of '__rolq' follows constexpr declaration
  676 | inline uint64_t _rotl64(uint64_t value, int shift) {
      |                 ^
C:/msys64/clang64/include/intrin.h:518:17: note: expanded from macro '_rotl64'
  518 | #define _rotl64 __rolq
      |                 ^
C:/msys64/clang64/lib/clang/19/include/ia32intrin.h:668:1: note: previous declaration is here
  668 | __rolq(unsigned long long __X, int __C) {
      | ^
1 error generated.
In file included from ppc_recomp.95.cpp:1:
In file included from ./ppc_recomp_shared.h:4:
./ppc_context.h:676:17: error: non-constexpr declaration of '__rolq' follows constexpr declaration
  676 | inline uint64_t _rotl64(uint64_t value, int shift) {
      |                 ^
C:/msys64/clang64/include/intrin.h:518:17: note: expanded from macro '_rotl64'
  518 | #define _rotl64 __rolq
      |                 ^
C:/msys64/clang64/lib/clang/19/include/ia32intrin.h:668:1: note: previous declaration is here
  668 | __rolq(unsigned long long __X, int __C) {
      | ^
ppc_recomp.95.cpp:4519:61: error: invalid operands to binary expression ('PPCRegister' and 'int32_t'
      (aka 'int'))
 4519 |         ctx.r9.s32 = int16_t(__builtin_bswap16(PPC_LOAD_U16(ctx.r0 + ctx.r11.s32)));
      |                                                             ~~~~~~ ^ ~~~~~~~~~~~
./ppc_context.h:42:73: note: expanded from macro 'PPC_LOAD_U16'
   42 | #define PPC_LOAD_U16(x) __builtin_bswap16(*(volatile uint16_t*)(base + (x)))
      |                                                                         ^
ppc_recomp.95.cpp:6305:62: error: invalid operands to binary expression ('PPCRegister' and 'int32_t'
      (aka 'int'))
 6305 |         ctx.r10.s32 = int16_t(__builtin_bswap16(PPC_LOAD_U16(ctx.r0 + ctx.r11.s32)));
      |                                                              ~~~~~~ ^ ~~~~~~~~~~~
./ppc_context.h:42:73: note: expanded from macro 'PPC_LOAD_U16'
   42 | #define PPC_LOAD_U16(x) __builtin_bswap16(*(volatile uint16_t*)(base + (x)))
      |                                                                         ^
3 errors generated.
In file included from ppc_recomp.115.cpp:1:
In file included from ./ppc_recomp_shared.h:4:
./ppc_context.h:688:17: error: non-constexpr declaration of '__rolq' follows constexpr declaration
  688 | inline uint64_t _rotl64(uint64_t value, int shift) {
      |                 ^
C:/msys64/clang64/include/intrin.h:518:17: note: expanded from macro '_rotl64'
  518 | #define _rotl64 __rolq
      |                 ^
C:/msys64/clang64/lib/clang/19/include/ia32intrin.h:668:1: note: previous declaration is here
  668 | __rolq(unsigned long long __X, int __C) {
      | ^
ppc_recomp.115.cpp:2532:61: error: redefinition of 'sub_825129F0'
 2532 | __attribute__((alias("__imp__sub_825129F0"))) PPC_WEAK_FUNC(sub_825129F0);
      |                                                             ^
ppc_recomp.115.cpp:2453:61: note: previous definition is here
 2453 | __attribute__((alias("__imp__sub_825129F0"))) PPC_WEAK_FUNC(sub_825129F0);
      |                                                             ^
ppc_recomp.115.cpp:2533:15: error: redefinition of '__imp__sub_825129F0'
 2533 | PPC_FUNC_IMPL(__imp__sub_825129F0) {
      |               ^
ppc_recomp.115.cpp:2454:15: note: previous definition is here
 2454 | PPC_FUNC_IMPL(__imp__sub_825129F0) {
      |               ^
ppc_recomp.115.cpp:2550:61: error: redefinition of 'sub_825129F8'
 2550 | __attribute__((alias("__imp__sub_825129F8"))) PPC_WEAK_FUNC(sub_825129F8);
      |                                                             ^
ppc_recomp.115.cpp:2541:61: note: previous definition is here
 2541 | __attribute__((alias("__imp__sub_825129F8"))) PPC_WEAK_FUNC(sub_825129F8);
      |                                                             ^
ppc_recomp.115.cpp:2551:15: error: redefinition of '__imp__sub_825129F8'
 2551 | PPC_FUNC_IMPL(__imp__sub_825129F8) {
      |               ^
ppc_recomp.115.cpp:2542:15: note: previous definition is here
 2542 | PPC_FUNC_IMPL(__imp__sub_825129F8) {
      |               ^
ppc_recomp.115.cpp:2696:61: error: redefinition of 'sub_82512A00'
 2696 | __attribute__((alias("__imp__sub_82512A00"))) PPC_WEAK_FUNC(sub_82512A00);
      |                                                             ^
ppc_recomp.115.cpp:2625:61: note: previous definition is here
 2625 | __attribute__((alias("__imp__sub_82512A00"))) PPC_WEAK_FUNC(sub_82512A00);
      |                                                             ^
ppc_recomp.115.cpp:2697:15: error: redefinition of '__imp__sub_82512A00'
 2697 | PPC_FUNC_IMPL(__imp__sub_82512A00) {
      |               ^
ppc_recomp.115.cpp:2626:15: note: previous definition is here
 2626 | PPC_FUNC_IMPL(__imp__sub_82512A00) {
      |               ^
ppc_recomp.115.cpp:2714:61: error: redefinition of 'sub_82512A08'
 2714 | __attribute__((alias("__imp__sub_82512A08"))) PPC_WEAK_FUNC(sub_82512A08);
      |                                                             ^
ppc_recomp.115.cpp:2705:61: note: previous definition is here
 2705 | __attribute__((alias("__imp__sub_82512A08"))) PPC_WEAK_FUNC(sub_82512A08);
      |                                                             ^
ppc_recomp.115.cpp:2715:15: error: redefinition of '__imp__sub_82512A08'
 2715 | PPC_FUNC_IMPL(__imp__sub_82512A08) {
      |               ^
ppc_recomp.115.cpp:2706:15: note: previous definition is here
 2706 | PPC_FUNC_IMPL(__imp__sub_82512A08) {
      |               ^
ppc_recomp.115.cpp:2844:61: error: redefinition of 'sub_82512A10'
 2844 | __attribute__((alias("__imp__sub_82512A10"))) PPC_WEAK_FUNC(sub_82512A10);
      |                                                             ^
ppc_recomp.115.cpp:2781:61: note: previous definition is here
 2781 | __attribute__((alias("__imp__sub_82512A10"))) PPC_WEAK_FUNC(sub_82512A10);
      |                                                             ^
ppc_recomp.115.cpp:2845:15: error: redefinition of '__imp__sub_82512A10'
 2845 | PPC_FUNC_IMPL(__imp__sub_82512A10) {
      |               ^
ppc_recomp.115.cpp:2782:15: note: previous definition is here
 2782 | PPC_FUNC_IMPL(__imp__sub_82512A10) {
      |               ^
ppc_recomp.115.cpp:2862:61: error: redefinition of 'sub_82512A18'
 2862 | __attribute__((alias("__imp__sub_82512A18"))) PPC_WEAK_FUNC(sub_82512A18);
      |                                                             ^
ppc_recomp.115.cpp:2853:61: note: previous definition is here
 2853 | __attribute__((alias("__imp__sub_82512A18"))) PPC_WEAK_FUNC(sub_82512A18);
      |                                                             ^
ppc_recomp.115.cpp:2863:15: error: redefinition of '__imp__sub_82512A18'
 2863 | PPC_FUNC_IMPL(__imp__sub_82512A18) {
      |               ^
ppc_recomp.115.cpp:2854:15: note: previous definition is here
 2854 | PPC_FUNC_IMPL(__imp__sub_82512A18) {
      |               ^
ppc_recomp.115.cpp:2930:61: error: redefinition of 'sub_82512A20'
 2930 | __attribute__((alias("__imp__sub_82512A20"))) PPC_WEAK_FUNC(sub_82512A20);
      |                                                             ^
ppc_recomp.115.cpp:2921:61: note: previous definition is here
 2921 | __attribute__((alias("__imp__sub_82512A20"))) PPC_WEAK_FUNC(sub_82512A20);
      |                                                             ^
ppc_recomp.115.cpp:2931:15: error: redefinition of '__imp__sub_82512A20'
 2931 | PPC_FUNC_IMPL(__imp__sub_82512A20) {
      |               ^
ppc_recomp.115.cpp:2922:15: note: previous definition is here
 2922 | PPC_FUNC_IMPL(__imp__sub_82512A20) {
      |               ^
ppc_recomp.115.cpp:2994:61: error: redefinition of 'sub_82512A28'
 2994 | __attribute__((alias("__imp__sub_82512A28"))) PPC_WEAK_FUNC(sub_82512A28);
      |                                                             ^
ppc_recomp.115.cpp:2985:61: note: previous definition is here
 2985 | __attribute__((alias("__imp__sub_82512A28"))) PPC_WEAK_FUNC(sub_82512A28);
      |                                                             ^
ppc_recomp.115.cpp:2995:15: error: redefinition of '__imp__sub_82512A28'
 2995 | PPC_FUNC_IMPL(__imp__sub_82512A28) {
      |               ^
ppc_recomp.115.cpp:2986:15: note: previous definition is here
 2986 | PPC_FUNC_IMPL(__imp__sub_82512A28) {
      |               ^
ppc_recomp.115.cpp:3092:61: error: redefinition of 'sub_82512A30'
 3092 | __attribute__((alias("__imp__sub_82512A30"))) PPC_WEAK_FUNC(sub_82512A30);
      |                                                             ^
ppc_recomp.115.cpp:3045:61: note: previous definition is here
 3045 | __attribute__((alias("__imp__sub_82512A30"))) PPC_WEAK_FUNC(sub_82512A30);
      |                                                             ^
ppc_recomp.115.cpp:3093:15: error: redefinition of '__imp__sub_82512A30'
 3093 | PPC_FUNC_IMPL(__imp__sub_82512A30) {
      |               ^
ppc_recomp.115.cpp:3046:15: note: previous definition is here
 3046 | PPC_FUNC_IMPL(__imp__sub_82512A30) {
      |               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

I also have to mention that I did use modified Recomp and Analyzer from #34 with little bit of modifcation to include missing instruction that I needed. Got the output with no errors mentioned. For argument I used clang++ -o NSUNSG.exe ppc_func_mapping.cpp ppc_recomp.*.cpp -std=c++17 -Wno-deprecated

zeerowiibu avatar Mar 05 '25 16:03 zeerowiibu

try adding -std=c++20 -O2 -mssse3 -msse4.1 -mavx -include pch.h just to see. I did that and I got far.

Once that works join me here https://discord.gg/xxgdUubG and ill provide you with the code im working on taken from sonic unleashed recompiled repurposed for acutally providng the GUI and the backend stuff. which should get it running.

Hewillalwaysbeagem avatar Mar 06 '25 19:03 Hewillalwaysbeagem

Im so sorry but I forgot to remove -include pch.h

-std=c++20 -O2 -mssse3 -msse4.1 -mavx

is the correct command.

join the discord I made and I can share you the files for the backend gui im working on

Hewillalwaysbeagem avatar Mar 07 '25 13:03 Hewillalwaysbeagem