Skip to content

Windows ARM support #545

Open
Open

Description

@basharast

Hi,
I just want to know if it's possible to compile flycast libretro core for ARM32 (specifically for UWP)
Interpreter worked fine (partially because some games has textures issue) but it's almost stable
Dynarec was not possible because the arm32 code is for linux only if FEAT_SHREC = DYNAREC_JIT,
the only way I was able to compile is to activate the below options FEAT_SHREC = DYNAREC_CPP:

#if defined(TARGET_NO_JIT)
#define FEAT_SHREC DYNAREC_CPP
#define FEAT_AREC DYNAREC_NONE
#define FEAT_DSPREC DYNAREC_NONE
#endif

but I got black screen only (no crash happening)
I just need to know if there is any possible chance to get the dynarec working on UWP ARM32

Many thanks for your support.

Activity

  1. flyinghead commented on Feb 24, 2022

    @flyinghead
    Owner

    I haven't looked at arm32 or arm64 on UWP at all so I don't know the extent of changes required to support them. I would think it's more complex than just setting some #define and certainly requires some additional code.

  2. added
    enhancement
    on Feb 24, 2022
  3. changed the title [-]Dynarec support for libretro ARM32[/-] [+]Windows ARM support[/+] on May 1, 2022
  4. Wunkolo commented on Dec 30, 2022

    @Wunkolo
    Contributor

    Been trying to get a build going to get some scope for what it takes to do this.
    There are some OS-specific things that have to be done around oslib.h and unwind_info.cpp and other such things now that there is a Windows-ARM platform to anticipate.

    #ifdef _WIN64
    #ifdef __MINGW64__
    struct _RUNTIME_FUNCTION;
    typedef struct _RUNTIME_FUNCTION RUNTIME_FUNCTION;
    #else
    + #ifdef _M_ARM64 
    + struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;
    + typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION;
    + #else
    struct _IMAGE_RUNTIME_FUNCTION_ENTRY;
    typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION;
    #endif
    #endif
    + #endif

    Because RUNTIME_FUNCTION is different on ARM64:

    typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY {
        DWORD BeginAddress;
        union {
            DWORD UnwindData;
            struct {
                DWORD Flag : 2;
                DWORD FunctionLength : 11;
                DWORD RegF : 3;
                DWORD RegI : 4;
                DWORD H : 1;
                DWORD CR : 2;
                DWORD FrameSize : 9;
            } DUMMYSTRUCTNAME;
        } DUMMYUNIONNAME;
    } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, * PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;

    some functions like UnwindInfo::end will have to be adjusted to some of these changes like the lack of EndAddress.

    size_t UnwindInfo::end(u32 offset, ptrdiff_t rwRxOffset)
    {
    u8 *endAddr = startAddr + offset;
    if ((uintptr_t)endAddr & 3)
    offset += 4 - ((uintptr_t)endAddr & 3);
    u8 *unwindInfo = startAddr + offset;
    memcpy(unwindInfo, &codes[0], codes.size() * sizeof(u16));
    RUNTIME_FUNCTION *table = (RUNTIME_FUNCTION *)(unwindInfo + codes.size() * sizeof(u16));
    table[0].BeginAddress = 0;
    table[0].EndAddress = (DWORD)(endAddr - startAddr);
    #ifndef __MINGW64__
    table[0].UnwindInfoAddress = (DWORD)(unwindInfo - startAddr);
    #else
    table[0].UnwindData = (DWORD)(unwindInfo - startAddr);
    #endif
    bool result = RtlAddFunctionTable(table, 1, (DWORD64)startAddr);
    tables.push_back(table);
    DEBUG_LOG(DYNAREC, "RtlAddFunctionTable %p sz %d rc %d tables: %d", startAddr, table[0].EndAddress, result, (u32)tables.size());
    return (unwindInfo + codes.size() * sizeof(u16) + sizeof(RUNTIME_FUNCTION)) - endAddr;
    }

  5. flyinghead commented on Jan 8, 2023

    @flyinghead
    Owner

    Dynamic unwind information isn't absolutely needed to get a first build working. This is just needed to be able to throw exceptions through dynarec blocks. (There's no unwind info on arm32 for example.)

    The main reason there's no build yet is that I don't have a hardware platform to test with.

  6. Wunkolo commented on Oct 7, 2024

    @Wunkolo
    Contributor

    On latest I was able to get it to work, just had to fix an include-order issue in rec_arm64.cpp.
    This is Jet Grind Radio on Vulkan on a ThinkPad x13s.

    Screen.Recording.2024-10-06.195716.mp4
  7. flyinghead commented on Oct 7, 2024

    @flyinghead
    Owner

    Nice!
    Can you share the change(s) you made?

  8. ArminiusTux commented on Sep 14, 2025

    @ArminiusTux

    Greetings,

    there seems to be a linkage problem with flycast v2.5:

    Build started at 19:03...
    1>------ Build started: Project: zlibstatic, Configuration: Release arm64 ------
    2>------ Build started: Project: xxhash, Configuration: Release arm64 ------
    3>------ Build started: Project: nowide, Configuration: Release arm64 ------
    4>------ Build started: Project: lzma, Configuration: Release arm64 ------
    5>------ Build started: Project: libzstd_static, Configuration: Release arm64 ------
    6>------ Build started: Project: glslang-default-resource-limits, Configuration: Release arm64 ------
    7>------ Build started: Project: elf, Configuration: Release arm64 ------
    8>------ Build started: Project: OSDependent, Configuration: Release arm64 ------
    1>zlibstatic.vcxproj -> X:\CODE\flycast\build\core\deps\libchdr\deps\zlib-1.3.1\Release\zlibstatic.lib
    4>lzma.vcxproj -> X:\CODE\flycast\build\core\deps\libchdr\deps\lzma-24.05\Release\lzma.lib
    8>OSDependent.vcxproj -> X:\CODE\flycast\build\core\deps\glslang\glslang\OSDependent\Windows\Release\OSDependent.lib
    3>nowide.vcxproj -> X:\CODE\flycast\build\core\deps\nowide\Release\nowide.lib
    9>------ Build started: Project: OGLCompiler, Configuration: Release arm64 ------
    10>------ Build started: Project: GenericCodeGen, Configuration: Release arm64 ------
    5>libzstd_static.vcxproj -> X:\CODE\flycast\build\core\deps\libchdr\deps\zstd-1.5.6\build\cmake\lib\Release\zstd_static.lib
    2>xxhash.vcxproj -> X:\CODE\flycast\build\core\deps\xxHash\cmake_unofficial\Release\xxhash.lib
    9>OGLCompiler.vcxproj -> X:\CODE\flycast\build\core\deps\glslang\OGLCompilersDLL\Release\OGLCompiler.lib
    11>------ Build started: Project: chdr-static, Configuration: Release arm64 ------
    10>GenericCodeGen.vcxproj -> X:\CODE\flycast\build\core\deps\glslang\glslang\Release\GenericCodeGen.lib
    12>------ Build started: Project: MachineIndependent, Configuration: Release arm64 ------
    6>glslang-default-resource-limits.vcxproj -> X:\CODE\flycast\build\core\deps\glslang\glslang\Release\glslang-default-resource-limits.lib
    11>chdr-static.vcxproj -> X:\CODE\flycast\build\core\deps\libchdr\Release\chdr-static.lib
    12>MachineIndependent.vcxproj -> X:\CODE\flycast\build\core\deps\glslang\glslang\Release\MachineIndependent.lib
    7>elf.vcxproj -> X:\CODE\flycast\build\core\deps\libelf\Release\elf.lib
    13>------ Build started: Project: SPIRV, Configuration: Release arm64 ------
    13>SPIRV.vcxproj -> X:\CODE\flycast\build\core\deps\glslang\SPIRV\Release\SPIRV.lib
    14>------ Build started: Project: flycast, Configuration: Release arm64 ------
    14>LINK : warning LNK4044: unrecognized option '/s'; ignored
    14>dreampicoport.obj : error LNK2019: unresolved external symbol __imp_SetupDiEnumDeviceInfo referenced in function "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl DreamPicoPortSerialHandler::getFirstSerialDevice(void)" (?getFirstSerialDevice@DreamPicoPortSerialHandler@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
    14>dreampicoport.obj : error LNK2019: unresolved external symbol __imp_SetupDiDestroyDeviceInfoList referenced in function "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl DreamPicoPortSerialHandler::getFirstSerialDevice(void)" (?getFirstSerialDevice@DreamPicoPortSerialHandler@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
    14>dreampicoport.obj : error LNK2019: unresolved external symbol __imp_SetupDiGetClassDevsA referenced in function "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl DreamPicoPortSerialHandler::getFirstSerialDevice(void)" (?getFirstSerialDevice@DreamPicoPortSerialHandler@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
    14>dreampicoport.obj : error LNK2019: unresolved external symbol __imp_SetupDiOpenDevRegKey referenced in function "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl DreamPicoPortSerialHandler::getFirstSerialDevice(void)" (?getFirstSerialDevice@DreamPicoPortSerialHandler@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
    14>dreampicoport.obj : error LNK2019: unresolved external symbol __imp_SetupDiGetDeviceRegistryPropertyA referenced in function "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl DreamPicoPortSerialHandler::getFirstSerialDevice(void)" (?getFirstSerialDevice@DreamPicoPortSerialHandler@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
    14>X:\CODE\flycast\build\Release\flycast.exe : fatal error LNK1120: 5 unresolved externals
    14>Done building project "flycast.vcxproj" -- FAILED.
    15>------ Build started: Project: ALL_BUILD, Configuration: Release arm64 ------
    15>Building Custom Rule X:/CODE/flycast/CMakeLists.txt
    16>------ Skipped Build: Project: PACKAGE, Configuration: Release arm64 ------
    16>Project not selected to build for this solution configuration 
    17>------ Skipped Build: Project: INSTALL, Configuration: Release arm64 ------
    17>Project not selected to build for this solution configuration 
    ========== Build: 14 succeeded, 1 failed, 3 up-to-date, 2 skipped ==========
    ========== Build completed at 19:03 and took 06,503 seconds ==========
    
    

    Compiling v2.4 for Windows on ARM was fine.

  9. scribam commented on Sep 15, 2025

    @scribam
    Collaborator

    @ArminiusTux Can you post your cmake commands related to your build issue please?

  10. ArminiusTux commented on Sep 20, 2025

    @ArminiusTux

    Here you go @scribam :

    $ cmake .. -G "Visual Studio 17 2022" -A arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake
    -- The C compiler identification is MSVC 19.44.35216.0
    -- The CXX compiler identification is MSVC 19.44.35216.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostarm64/arm64/cl.exe - 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: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostarm64/arm64/cl.exe - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Target architecture: arm64
    -- Found Git: C:/Program Files/Git/clangarm64/bin/git.exe (found version "2.51.0.windows.1")
    -- Found OpenMP_C: -openmp (found version "2.0")
    -- Found OpenMP_CXX: -openmp (found version "2.0")
    -- Found OpenMP: TRUE (found version "2.0")
    -- Architecture: ARM64
    CMake Deprecation Warning at core/deps/glm/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.
    
    
    CMake Deprecation Warning at core/deps/glm/CMakeLists.txt:2 (cmake_policy):
      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.
    
    
    -- Using Debug VC++ CRT: MDd
    -- Using Release VC++ CRT: MD
    -- Using MinSizeRel VC++ CRT: MD
    -- Using RelWithDebInfo VC++ CRT: MD
    -- Using Release VC++ CRT: MD
    -- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
    -- Found ZLIB: optimized;D:/vcpkg/installed/arm64-windows/lib/zlib.lib;debug;D:/vcpkg/installed/arm64-windows/debug/lib/zlibd.lib (found version "1.3.1")
    -- Found PkgConfig: D:/vcpkg/installed/arm64-windows/tools/pkgconf/pkgconf.exe (found version "2.5.1")
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of off64_t
    -- Check size of off64_t - failed
    -- Looking for fseeko
    -- Looking for fseeko - not found
    -- Looking for unistd.h
    -- Looking for unistd.h - not found
    -- Renaming
    --     X:/CODE/flycast/core/deps/libchdr/deps/zlib-1.3.1/zconf.h
    -- to 'zconf.h.included' because this file is included with zlib
    -- but CMake generates it automatically in the build directory.
    CMake Deprecation Warning at core/deps/libchdr/deps/zstd-1.5.6/build/cmake/CMakeLists.txt:10 (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.
    
    
    -- The ASM compiler identification is MSVC
    CMake Warning (dev) at C:/Program Files/CMake/share/cmake-4.1/Modules/CMakeDetermineASMCompiler.cmake:234 (message):
      Policy CMP194 is not set: MSVC is not an assembler for language ASM.  Run
      "cmake --help-policy CMP194" for policy details.  Use the cmake_policy
      command to set the policy and suppress this warning.
    Call Stack (most recent call first):
      core/deps/libchdr/deps/zstd-1.5.6/build/cmake/CMakeLists.txt:33 (project)
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostarm64/arm64/cl.exe
    -- ZSTD VERSION: 1.5.6
    -- Performing Test C_FLAG_MP
    -- Performing Test C_FLAG_MP - Success
    -- Performing Test CXX_FLAG_MP
    -- Performing Test CXX_FLAG_MP - Success
    -- Performing Test C_FLAG_D_UNICODE
    -- Performing Test C_FLAG_D_UNICODE - Success
    -- Performing Test CXX_FLAG_D_UNICODE
    -- Performing Test CXX_FLAG_D_UNICODE - Success
    -- Performing Test C_FLAG_DUNICODE
    -- Performing Test C_FLAG_DUNICODE - Success
    -- Performing Test CXX_FLAG_DUNICODE
    -- Performing Test CXX_FLAG_DUNICODE - Success
    -- CMAKE_INSTALL_PREFIX: C:/Program Files (x86)/flycast
    -- CMAKE_INSTALL_LIBDIR: lib
    -- ZSTD_LEGACY_SUPPORT not defined!
    -- ZSTD_MULTITHREAD_SUPPORT is enabled
    CMake Deprecation Warning at core/deps/libchdr/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.
    
    
    -- Looking for _M_AMD64
    -- Looking for _M_AMD64 - not found
    -- Checking for module 'ao'
    --   Found ao, version 1.2.2
    -- Checking for module 'libpulse'
    --   Package 'libpulse' not found
    -- Checking for module 'libzip'
    --   Found libzip, version 1.11.4
    -- Found MiniUPnPc: D:/vcpkg/installed/arm64-windows/include/miniupnpc
    -- Found miniupnpc API version 20
    CMake Deprecation Warning at core/deps/nowide/CMakeLists.txt:16 (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.
    
    
    -- Performing Test NOWIDE_HAS_LFS
    -- Performing Test NOWIDE_HAS_LFS - Success
    -- Performing Test NOWIDE_HAS_INIT_PRIORITY
    -- Performing Test NOWIDE_HAS_INIT_PRIORITY - Failed
    CMake Deprecation Warning at core/deps/libelf/CMakeLists.txt:7 (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 (49.9s)
    -- Generating done (0.7s)
    -- Build files have been written to: X:/CODE/flycast/build
    
  11. scribam commented on Sep 23, 2025

    @scribam
    Collaborator

    @ArminiusTux The dev branch now has a fix for your build issue, try it

  12. ArminiusTux commented on Sep 28, 2025

    @ArminiusTux

    Splendid, even Vulkan is working with this dev build!

    Image

    @scribam
    Thanks a lot for the compilation fix, hopefully it will make its way into the main branch soon!

    @flyinghead Any plans on offering official ARM64 builds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions