libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.31k stars 1.73k forks source link

Build failed for arm64ec target architecture #10307

Open brianGriifin114 opened 1 month ago

brianGriifin114 commented 1 month ago

Hi, we are the MSVC test team and we found that SDL build fails for arm64ec target architecture. here's a part of error info

8>Link:
            Creating library C:/gitP/spurious/SDL-mirror/build_arm64ec/Release/SDL2.lib and object C:/gitP/spurious/SDL-mirror/build_arm64ec/Release/SDL2.exp
     8>LINK : warning LNK4294: missing EC version of load config symbol for ARM64X image [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_dinputhaptic.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_xinputhaptic.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_hidapi_xboxone.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_hidapijoystick.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_dinputjoystick.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_xinputjoystick.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_hidapi_stadia.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_hidapi_switch.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_hidapi_xbox360.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]
     8>SDL_hidapi_xbox360w.obj : error LNK2001: unresolved external symbol #__chkstk_arm64ec (EC Symbol) [C:\gitP\spurious\SDL-mirror\build_arm64ec\SDL2.vcxproj]

It seems caused by incompatibilities in the libraries.However, I noticed the issue https://github.com/libsdl-org/SDL/issues/8759, which mentioned that it can be compiled successfully under arm64ec. Is there something wrong with my configuration? I attached the setup.log and build.log for reference. If you guys need any more information, please let me know. Thanks! Build (3).log Setup (1).log

slouken commented 1 month ago

Try running cmake with -DSDL_LIBC=ON. This is the default for SDL3, which was where I was reporting it worked in #8759.

brianGriifin114 commented 1 month ago

cmake -G "Visual Studio 17 2022" -A ARM64EC -DCMAKE_SYSTEM_VERSION=10.0.22621.0 -DSDL_LIBC=ON .. 2>&1

CMake Warning:
  Manually-specified variables were not used by the project:

    SDL_LIBC

I tried it, but the same problem occurs(setup success and build failed).Maybe it's because of the SDL version? I'm using SDL2.I can provide steps to reproduce if necessary.

madebr commented 1 month ago

In https://github.com/libsdl-org/SDL/pull/10312, ARM64EC detection is added and SDL_LIBC defaults to true for arm64ec.

With this GitHub workflow patch, I can confirm it works. For current SDL2 releases (that don't know how to detect arm64ec), configuring with -DSDL_LIBC=ON should do the job. I don't know why -DSDL_LIBC is considered non-used: it's here in the cmake script.

I couldn't test the -A ARM64EC integration because it is not available in current CMake versions.

brianGriifin114 commented 1 month ago

Thanks for your answer. We will modify the build script soon and see if there are any problems.