Cannot compile dynarmic (Switch)
NotToDisturb opened this issue · 5 comments
Hello there! I am running into some issues when trying to compile citra for Switch (the vulkan version from here), and I traced the issue to dynarmic. I have tried compiling dynarmic individually both on the commit used by citra and mainline, and all three produce the same error:
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp: In lambda function:
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:182:9: error: ‘_aarch64_ctx’ was not declared in this scope
182 | _aarch64_ctx* header = (_aarch64_ctx*)&mctx.__reserved;
| ^~~~~~~~~~~~
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:182:23: error: ‘header’ was not declared in this scope
182 | _aarch64_ctx* header = (_aarch64_ctx*)&mctx.__reserved;
| ^~~~~~
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:182:46: error: expected primary-expression before ‘)’ token
182 | _aarch64_ctx* header = (_aarch64_ctx*)&mctx.__reserved;
| ^
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:183:33: error: ‘FPSIMD_MAGIC’ was not declared in this scope
183 | while (header->magic != FPSIMD_MAGIC) {
| ^~~~~~~~~~~~
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:185:36: error: expected primary-expression before ‘)’ token
185 | header = (_aarch64_ctx*)((char*)header + header->size);
| ^
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:187:17: error: ‘fpsimd_context’ was not declared in this scope; did you mean ‘sigcontext’?
187 | return (fpsimd_context*)header;
| ^~~~~~~~~~~~~~
| sigcontext
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:187:32: error: expected primary-expression before ‘)’ token
187 | return (fpsimd_context*)header;
| ^
/home/disturbo/Documents/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp:187:33: error: expected ‘;’ before ‘header’
187 | return (fpsimd_context*)header;
| ^~~~~~
| ;
make[2]: *** [src/dynarmic/CMakeFiles/dynarmic.dir/build.make:3037: src/dynarmic/CMakeFiles/dynarmic.dir/backend/exception_handler_posix.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:1055: src/dynarmic/CMakeFiles/dynarmic.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
This is the CMake log:
-- The C compiler identification is GNU 12.2.1
-- The CXX compiler identification is GNU 12.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- 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
-- Defaulting to a Release build
-- Target architecture: arm64
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found suitable version "1.78.0", minimum required is "1.57")
-- Performing Test HAVE_FLAG__ffile_prefix_map__home_disturbo_Documents_dynarmic_externals_catch__
-- Performing Test HAVE_FLAG__ffile_prefix_map__home_disturbo_Documents_dynarmic_externals_catch__ - Success
-- Configuring done (3.1s)
-- Generating done (0.2s)
-- Build files have been written to: /home/disturbo/Documents/dynarmic/build
I am running the build both through citra's own installing and by doing cmake ..
in a build
folder within dynarmic path. Not sure what else I should provide here, any help is appreciated, thanks!
Quick update on this, I just got dynarmic to build independently, now checking if it works for citra as well. Only a minor change was needed in line 12 of exception_handler_posix.cpp
, replacing it with:
# define CONFIG_64BIT
# include <signal.h>
I think this can't be used as a generic solution, but I don't really know enough.
Hi! Those structures are operating system dependent. I do not think HOS would have similar ucontext structures, and I wonder if signal handlers are even implemented. The easiest thing to do is to disable fastmem when compiling for Switch.
For some reason I forgot to mention this isn't for HOS, it's being done for Fedora 37.
I am quite confused. This appears to be a patch introduced in some forks of the linux kernel.
Here is mainline uapi/asm/sigcontext.h which does not expose the kernel-specific define CONFIG_64BIT
.
Here's an android linux commit (same l4t kernel commit) that introduces this define in the uapi space, which I don't think is a kosher userspace change.
Environment issue. See similar patch here. This should be fixed by whoever provides your linux kernel headers.