Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows on ARM support #6439

Open
Xazax-hun opened this issue Aug 6, 2023 · 12 comments
Open

Windows on ARM support #6439

Xazax-hun opened this issue Aug 6, 2023 · 12 comments

Comments

@Xazax-hun
Copy link

Currently, there is no native Windows on ARM releae.

@AJenbo
Copy link
Member

AJenbo commented Aug 6, 2023

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

@Xazax-hun
Copy link
Author

Xazax-hun commented Aug 6, 2023

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

@Xazax-hun
Copy link
Author

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
Copy link
Member

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

@Xazax-hun
Copy link
Author

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
Copy link
Author

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

Ok, giving this a try.

@Xazax-hun
Copy link
Author

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
Copy link
Member

AJenbo commented Aug 6, 2023

Is this a 32bit system?

@Xazax-hun
Copy link
Author

Nope, it is Arm64.

@glebm
Copy link
Collaborator

glebm commented Aug 6, 2023

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

@glebm
Copy link
Collaborator

glebm commented Aug 6, 2023

There is this closed (unmerged) ZeroTierOne PR that adds ARM support: zerotier/ZeroTierOne#1837

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

@Xazax-hun
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants