diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.09k stars 794 forks source link

Windows on ARM support #6439

Open Xazax-hun opened 1 year ago

Xazax-hun commented 1 year ago

Currently, there is no native Windows on ARM releae.

AJenbo commented 1 year ago

Are you able to build and or test it? I don't know anyone with a ARM system running Windows.

Xazax-hun commented 1 year ago

I can give it a try. Will report back with the results. (Might not do it this weekend though.)

Xazax-hun commented 1 year ago

I tried building the latest master like:

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=path/from/vcpkg
cmake --build .

And I run into the following error for many translation units:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\emmintrin.h(20,1): fat
al  error C1189: #error:  This header is specific to X86, X64, ARM64, and ARM64EC targets [C:\Dev\devilutionX\build\_de
ps\libzt-build\zto_pic.vcxproj]

I have VS Build Tools 17.6.5 installed.

StephenCWills commented 1 year ago

Try again with cmake .. -DCMAKE_TOOLCHAIN_FILE=path/from/vcpkg -DDISABLE_ZERO_TIER=ON.

Xazax-hun commented 1 year ago

I could work around the compilation errors via cmake .. -DCMAKE_CXX_FLAGS="/DUSE_SOFT_INTRINSICS", only to run into link errors:

zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_loadu_ps referenced in function "public: void __cde
cl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\Dev\
devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_storeu_ps referenced in function "public: void __cd
ecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\Dev
\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_add_epi32 referenced in function "public: void __cd
ecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\Dev
\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_and_si128 referenced in function "public: void __cd
ecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\Dev
\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_or_si128 referenced in function "public: void __cde
cl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\Dev\
devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_xor_si128 referenced in function "public: void __cd
ecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\Dev
\devilutionX\build\devilutionx.vcxproj]
zt.lib(Packet.obj) : error LNK2001: unresolved external symbol _mm_xor_si128 [C:\Dev\devilutionX\build\devilutionx.vcxp
roj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_slli_epi32 referenced in function "public: void __c
decl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\De
v\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_slli_epi64 referenced in function "public: void __c
decl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\De
v\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_srli_epi32 referenced in function "public: void __c
decl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\De
v\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_srli_epi64 referenced in function "public: void __c
decl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\De
v\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_cvtsi32_si128 referenced in function "public: __cde
cl _s20sseconsts::_s20sseconsts(void)" (??0_s20sseconsts@@QEAA@XZ) [C:\Dev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_shuffle_epi32 referenced in function "public: void
__cdecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:
\Dev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_unpackhi_epi64 referenced in function "public: void
 __cdecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C
:\Dev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_unpacklo_epi64 referenced in function "public: void
 __cdecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C
:\Dev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_loadu_si128 referenced in function "public: void __
cdecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\D
ev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Packet.obj) : error LNK2001: unresolved external symbol _mm_loadu_si128 [C:\Dev\devilutionX\build\devilutionx.vc
xproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_castps_si128 referenced in function "public: void _
_cdecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\
Dev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Salsa20.obj) : error LNK2019: unresolved external symbol _mm_castsi128_ps referenced in function "public: void _
_cdecl ZeroTier::Salsa20::crypt12(void const *,void *,unsigned int)" (?crypt12@Salsa20@ZeroTier@@QEAAXPEBXPEAXI@Z) [C:\
Dev\devilutionX\build\devilutionx.vcxproj]
zt.lib(Packet.obj) : error LNK2019: unresolved external symbol _mm_storeu_si128 referenced in function "public: static
void __cdecl ZeroTier::Salsa20::memxor(unsigned char *,unsigned char const *,unsigned int)" (?memxor@Salsa20@ZeroTier@@
SAXPEAEPEBEI@Z) [C:\Dev\devilutionX\build\devilutionx.vcxproj]
C:\Dev\devilutionX\build\Debug\devilutionx.exe : fatal error LNK1120: 18 unresolved externals [C:\Dev\devilutionX\build
\devilutionx.vcxproj]

It is unrelated to the compilation problems, but I did see many warnings like:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\chrono(2316,9): warnin
g C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Dev\devilutionX\build\Sour
ce\libdevilutionx.vcxproj]
C:\Dev\devilutionX\Source\levels\drlg_l4.cpp(307,142): warning C4805: '|': unsafe mix of type 'int' and type 'bool' in
operation [C:\Dev\devilutionX\build\Source\libdevilutionx.vcxproj]
cl : command line  warning D9025: overriding '/W1' with '/w' [C:\Dev\devilutionX\build\_deps\sdl_audiolib-build\SDL_aud
iolib.vcxproj]
Xazax-hun commented 1 year ago

Try again with cmake .. -DCMAKE_TOOLCHAIN_FILE=path/from/vcpkg -DDISABLE_ZERO_TIER=ON.

Ok, giving this a try.

Xazax-hun commented 1 year ago

Try again with cmake .. -DCMAKE_TOOLCHAIN_FILE=path/from/vcpkg -DDISABLE_ZERO_TIER=ON.

This worked. The compilation succeeded, and the resulting binary worked well. I created a new char and killed a couple of critters, did not do any extensive testing.

AJenbo commented 1 year ago

Is this a 32bit system?

Xazax-hun commented 1 year ago

Nope, it is Arm64.

glebm commented 1 year ago

_mm_loadu_si128 is an x86-64 (SSE2) instruction, sounds like libzt incorrectly uses x86-64 instead of ARM asm on Windows

glebm commented 1 year ago

There is this closed (unmerged) ZeroTierOne PR that adds ARM support: https://github.com/zerotier/ZeroTierOne/pull/1837

Perhaps we should update to the latest libzt / ZeroTierOne first and see if it fixes the issue

Xazax-hun commented 11 months ago

Let me know if you need me to test something out.