prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.51k stars 1.9k forks source link

[Request] Windows 11 ARM64 build #12291

Open eblieb opened 4 months ago

eblieb commented 4 months ago

Requesting a Windows 11 Arm64 build. VS should be able to compile for Windows 11 Arm64 without much issue.

JustinBeckerMSFT commented 4 months ago

I second this suggestion. The only limiting factor I see is the kernel drivers for updating printer firmware would need to be ported.

It also looks like PrusaSlicer might have some prebuilt x64 dependencies, which isn't a problem: you could use our ARM64EC technology for that https://learn.microsoft.com/en-us/windows/arm/arm64ec

hmartinez82 commented 4 months ago

@eblieb @JustinBeckerMSFT I'm going to give it a try. I have a Windows Dev Kit.

hmartinez82 commented 4 months ago

Some news. While building the dependencies, only three packages failed. Glew, Boost and OpenEXR:

Glew fails to link with:

LINK: command "C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1439~1.335\bin\HOSTAR~1\arm64\link.exe /nologo CMakeFiles\glew.dir\C_\Dev\Github\PrusaSlicer\deps\build\dep_GLEW-prefix\src\dep_GLEW\src\glew.c.obj CMakeFiles\glew.dir\C_\Dev\Github\PrusaSlicer\deps\build\dep_GLEW-prefix\src\dep_GLEW\build\glew.rc.res /out:bin\glew32.dll /implib:lib\glew32.lib /pdb:bin\glew32.pdb /dll /version:2.2 /machine:ARM64 /INCREMENTAL:NO -BASE:0x62AA0000 -nodefaultlib -noentry libvcruntime.lib msvcrt.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1355) with the following output:
   Creating library lib\glew32.lib and object lib\glew32.exp
LINK : fatal error LNK1355: invalid base address 0x62AA0000; ARM64 image cannot have base address below 4GB
ninja: build stopped: subcommand failed.

Boost fails while building Boost Context and doing some arm assembling. ARMASM does not accept -D defines like MASM does:

[1/264] Building ASM_ARMASM object libs\context\CMakeFiles\boost_context.dir\src\asm\ontop_arm64_aapcs_pe_armasm.asm.obj
FAILED: libs/context/CMakeFiles/boost_context.dir/src/asm/ontop_arm64_aapcs_pe_armasm.asm.obj
C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1439~1.335\bin\HOSTAR~1\arm64\armasm64.exe -DBOOST_CONTEXT_EXPORT="" -DBOOST_CONTEXT_NO_LIB -DBOOST_CONTEXT_SOURCE -DBOOST_CONTEXT_STATIC_LINK -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\context\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\assert\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\config\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\core\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\static_assert\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\throw_exception\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\mp11\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\pool\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\integer\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\type_traits\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\winapi\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\predef\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\smart_ptr\include -IC:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\move\include  -o libs\context\CMakeFiles\boost_context.dir\src\asm\ontop_arm64_aapcs_pe_armasm.asm.obj C:\Dev\Github\PrusaSlicer\deps\build\dep_Boost-prefix\src\dep_Boost\libs\context\src\asm\ontop_arm64_aapcs_pe_armasm.asm
Microsoft (R) ARM Macro Assembler Version 14.39.33521.0 for 64 bits
Copyright (C) Microsoft Corporation.  All rights reserved.

error A2029: unknown command-line argument or argument value -DBOOST_CONTEXT_EXPORT=

 Usage:      armasm [<options>] sourcefile objectfile
             armasm [<options>] -o objectfile sourcefile
             armasm -h              for help

OpenEXR fails when trying to use intrinsics.

[3/33] Performing build step for 'dep_OpenEXR'
FAILED: dep_OpenEXR-prefix/src/dep_OpenEXR-stamp/dep_OpenEXR-build C:/Dev/Github/PrusaSlicer/deps/build/dep_OpenEXR-prefix/src/dep_OpenEXR-stamp/dep_OpenEXR-build
C:\Windows\system32\cmd.exe /C "cd /D C:\Dev\Github\PrusaSlicer\deps\build\builds\OpenEXR && "C:\Program Files\CMake\bin\cmake.exe" --build . --config Release -- -j6 && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/Dev/Github/PrusaSlicer/deps/build/dep_OpenEXR-prefix/src/dep_OpenEXR-stamp/dep_OpenEXR-build"
[1/83] Building CXX object OpenEXR\IlmImf\CMakeFiles\IlmImf.dir\ImfVersion.cpp.obj
[2/83] Building CXX object OpenEXR\IlmImf\CMakeFiles\IlmImf.dir\ImfPreviewImage.cpp.obj
[3/83] Building CXX object OpenEXR\IlmImf\CMakeFiles\IlmImf.dir\ImfDwaCompressor.cpp.obj
FAILED: OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfDwaCompressor.cpp.obj
C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1439~1.335\bin\HOSTAR~1\arm64\cl.exe  /nologo /TP  -IC:\Dev\Github\PrusaSlicer\deps\build\builds\OpenEXR\OpenEXR\IlmImf -IC:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\OpenEXR\IlmImf -IC:\Dev\Github\PrusaSlicer\deps\build\builds\OpenEXR\OpenEXR\config -IC:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\IlmBase\Iex -IC:\Dev\Github\PrusaSlicer\deps\build\builds\OpenEXR\IlmBase\config -IC:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\IlmBase\Half -IC:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\IlmBase\Imath -IC:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\IlmBase\IexMath -IC:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\IlmBase\IlmThread -external:IC:\Dev\Github\PrusaSlicer\deps\build\destdir\usr\local\include -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG /EHsc /showIncludes /FoOpenEXR\IlmImf\CMakeFiles\IlmImf.dir\ImfDwaCompressor.cpp.obj /FdOpenEXR\IlmImf\CMakeFiles\IlmImf.dir\IlmImf.pdb /FS -c C:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\OpenEXR\IlmImf\ImfDwaCompressor.cpp
C:\Dev\Github\PrusaSlicer\deps\build\dep_OpenEXR-prefix\src\dep_OpenEXR\OpenEXR\IlmImf\ImfName.h(113): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\include\emmintrin.h(20): fatal error C1189: #error:  This header is specific to X86, X64, ARM64, and ARM64EC targets
JustinBeckerMSFT commented 4 months ago
hmartinez82 commented 4 months ago
  • It looks like the issue with Glew is known and has been resolved in more recent revisions: Base address only for 32bit nigels-com/glew#384 I wonder if PrusaSlicer takes a hard dependency on the Glew version in the dependencies list or if pulling a new version would be sufficient?

That's awesome. If just a version bump is enough that'd be perfect. I'll try that in my next round of attempts.

  • Looking at the ASM, it looks like those defines aren't used anywhere in the file. It may be correct to just remove those -D options from the ARMASM command line.

Not trivial, it's not like there's code in PrusaSlicer's CMake files to explicitly add those -D defines. :( . I'll have to look at the Boost CMake input params to see why this is happening. Boost supposedly already support Windows on ARM for a while so I'd be suprise if there's a legit issue with Boost itself and ARMASM 🤞.

  • What target architecture are you using for this build? If OpenEXR uses Intel intrinsics, and doesn't have an ARM64 intrinsic equivalent implementation, then you will need to build as ARM64EC to get those intrinsics.

This is the trickiest. I'll take a look too, but I know we are building Glew for Windows on ARM, for a while now btw, in MSYS2 (https://packages.msys2.org/package/mingw-w64-clang-aarch64-glew?repo=clangarm64 so not exactly the same thing because MSYS2 uses Clang with GCC's frontend)

ggppjj commented 2 months ago

Hello!

I own an ARM64 Windows 11 Lenovo Thinkpad X13s, and while 64-bit PrusaSlicer does work, having native binaries would be a very nice thing to my mind. I'd be happy to provide a second test-bed once the build works on @hmartinez82's dev kit, although I'm unfortunately out of my depths for basically anything past that, especially considering the level of discussion here already.

TL;DR: There is at least one other person in the world with a released ARM64 laptop that is very interested in the progress of ARM64 builds! Thank you for continuing to investigate support for it.

hmartinez82 commented 2 weeks ago

It would be nice if the the PrusaSlicer team updated the dependencies to versions that support ARM64 then I could give it a try.

hmartinez82 commented 4 days ago

@enricoturri1966 @bubnikv Who can I ask to update and Boost and OpenEXR? I'm almost in the finish line with building PrusaSlicer's deps for Windows on ARM64. The only offending (not building for Windows on ARM64 with Visual Studio) 3rd party libraries are:

Newer versions of Boost already fixed the only issue I see with building it for ARM64 OpenEXR is super old. The deps folder is using version 2.5.5, but OpenEXR is already at 3.2.4. I'll create a pull request for GLEW shortly.

JustinBeckerMSFT commented 4 days ago

@hmartinez82 Since there are third party dependencies that aren't built for ARM64, you should look into ARM64EC (https://learn.microsoft.com/en-us/windows/arm/arm64ec) this technology will let you mix-and-match ARM64 and x64 code. This can all be done natively inside of Visual Studio. Please let me know if you have any questions :)