XenonRecomp icon indicating copy to clipboard operation
XenonRecomp copied to clipboard

Compilation troubles on Debian 12 (w/ debian-backports) • `…with constructor not allowed in anonymous aggregate`

Open ZaptorZap opened this issue 8 months ago • 5 comments

Hi all. I come to you with effectively no C++ knowledge, just a few years of experience compiling random projects. After git clone'ing and running git submodule update --init --recursive to fulfill cmake's demands, I am able to run make in a self-made build/ directory, but 47% in, it errors out with some details I can't discern. Details below:

cmake log
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- {fmt} version: 11.0.2
-- Build type: 
CMake Deprecation Warning at thirdparty/xxHash/cmake_unofficial/CMakeLists.txt:8 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- xxHash build type: Release
-- Architecture: x86_64
CMake Deprecation Warning at XenonRecomp/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /mnt/Storage/github-stuffs/XenonRecomp/build
make log
[  2%] Building C object thirdparty/disasm/CMakeFiles/disasm.dir/ppc-dis.c.o
[  5%] Building C object thirdparty/disasm/CMakeFiles/disasm.dir/disasm.c.o
[  8%] Linking C static library libdisasm.a
[  8%] Built target disasm
[ 11%] Building CXX object thirdparty/fmt/CMakeFiles/fmt.dir/src/format.cc.o
[ 14%] Building CXX object thirdparty/fmt/CMakeFiles/fmt.dir/src/os.cc.o
[ 17%] Linking CXX static library libfmt.a
[ 17%] Built target fmt
[ 20%] Building C object thirdparty/xxHash/cmake_unofficial/CMakeFiles/xxhash.dir/__/xxhash.c.o
[ 23%] Linking C static library libxxhash.a
[ 23%] Built target xxhash
[ 26%] Building C object thirdparty/xxHash/cmake_unofficial/CMakeFiles/xxhsum.dir/__/cli/xxhsum.c.o
[ 29%] Building C object thirdparty/xxHash/cmake_unofficial/CMakeFiles/xxhsum.dir/__/cli/xsum_os_specific.c.o
[ 32%] Building C object thirdparty/xxHash/cmake_unofficial/CMakeFiles/xxhsum.dir/__/cli/xsum_output.c.o
[ 35%] Building C object thirdparty/xxHash/cmake_unofficial/CMakeFiles/xxhsum.dir/__/cli/xsum_sanity_check.c.o
[ 38%] Building C object thirdparty/xxHash/cmake_unofficial/CMakeFiles/xxhsum.dir/__/cli/xsum_bench.c.o
[ 41%] Linking C executable xxhsum
[ 41%] Built target xxhsum
[ 44%] Building CXX object XenonUtils/CMakeFiles/XenonUtils.dir/disasm.cpp.o
[ 47%] Building CXX object XenonUtils/CMakeFiles/XenonUtils.dir/xex.cpp.o
In file included from /mnt/Storage/github-stuffs/XenonRecomp/XenonUtils/xex.h:3,
                 from /mnt/Storage/github-stuffs/XenonRecomp/XenonUtils/xex.cpp:1:
/mnt/Storage/github-stuffs/XenonRecomp/XenonUtils/xbox.h:248:26: error: member ‘be<unsigned int> _XXOVERLAPPED::<unnamed union>::<unnamed struct>::Error’ with constructor not allowed in anonymous aggregate
  248 |             be<uint32_t> Error;
      |                          ^~~~~
/mnt/Storage/github-stuffs/XenonRecomp/XenonUtils/xbox.h:249:26: error: member ‘be<unsigned int> _XXOVERLAPPED::<unnamed union>::<unnamed struct>::Length’ with constructor not allowed in anonymous aggregate
  249 |             be<uint32_t> Length;
      |                          ^~~~~~
make[2]: *** [XenonUtils/CMakeFiles/XenonUtils.dir/build.make:93: XenonUtils/CMakeFiles/XenonUtils.dir/xex.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:523: XenonUtils/CMakeFiles/XenonUtils.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
❯❯❯ cmake --version
cmake version 3.31.5
…
❯❯❯ clang --version
Debian clang version 19.1.4 (1~deb12u1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin

ZaptorZap avatar Mar 02 '25 23:03 ZaptorZap

edit: using clang doesn't have issue. so probably better.

the struct __XXOVERLAPPING in xbox.h and the union XDBFTitleID in xdbf.h are the issues, they have anonymous unions and structs.

typedef struct _XXOVERLAPPED {
    union
    {
        struct
        {
            be<uint32_t> Error;
            be<uint32_t> Length;
        };
//...

if you add names union bar, struct foo, etc., it will compile.

but then the assert just underneath will trigger since the struct is 20 bytes while the assert expects 28. since it doesn't seem used anywhere, I removed the assert and it compiled successfully.

minirop avatar Mar 03 '25 00:03 minirop

~~@minirop can you share where the assert was?~~

nvm, that was a dumb thing to ask after looking at the mentioned files. :p

mostwanted002 avatar Mar 03 '25 02:03 mostwanted002

Hmmm, I just read the hint to assign some variables to cmake at https://github.com/hedge-dev/XenonRecomp/issues/25#issuecomment-2694434733 and the source code compiles as-is now. For what it's worth, it compiled even after commenting out the assert I presume you originally mentioned, but i uncommented it back in.

ZaptorZap avatar Mar 03 '25 15:03 ZaptorZap

Same issue here on NixOS after I set CC and CXX to clang with no changes made to source

XenonRecomp/build on  main [?] via △ v3.31.5 via ❄️  impure (shell) took 2m27s
❯ echo $CXX
/nix/store/hwp5wkjs8kf8nvvkq3byv3zid7nclrvp-clang-19.1.7/bin/clang++

XenonRecomp/build on  main [?] via △ v3.31.5 via ❄️  impure (shell)
❯ echo $CC
/nix/store/hwp5wkjs8kf8nvvkq3byv3zid7nclrvp-clang-19.1.7/bin/clang

I'm a bit too dumb to understand what I need to do exactly lol :/

nonetrix avatar Mar 03 '25 18:03 nonetrix

Same issue here on NixOS after I set CC and CXX to clang with no changes made to source

XenonRecomp/build on  main [?] via △ v3.31.5 via ❄️  impure (shell) took 2m27s
❯ echo $CXX
/nix/store/hwp5wkjs8kf8nvvkq3byv3zid7nclrvp-clang-19.1.7/bin/clang++

XenonRecomp/build on  main [?] via △ v3.31.5 via ❄️  impure (shell)
❯ echo $CC
/nix/store/hwp5wkjs8kf8nvvkq3byv3zid7nclrvp-clang-19.1.7/bin/clang

I'm a bit too dumb to understand what I need to do exactly lol :/

I've sucessfull compiled using following this on Fedora 41. If you have problem at the first cmake instruction, just delete "-S" parameter and try again.

elpagano3 avatar Mar 03 '25 19:03 elpagano3