Skip to content

Support for ARM64 Windows (fixes #24603)

Serge S. Gulin requested to merge wip/T24603 into master
/----------------------------------------------------------\
| Successfully built program 'ghc-bin' (Stage1).           |
| Executable: _build/stage1/bin/ghc.exe                    |
| Program synopsis: The Glorious Glasgow Haskell Compiler. |
\----------------------------------------------------------/

A very early attempt to build GHC at Windows 11 ARM64.

Keep in mind that the following configuration and compiling options were used:

$ ./configure --with-intree-gmp --disable-tables-next-to-code -enable-distro-toolchain GHC=/c/Users/serge/Workspace/Self/ghc_build_w11_arm/stage0/bin/aarch64-unknown-mingw32-ghc.exe
$ GHC=/c/Users/serge/Workspace/Self/ghc_build_w11_arm/stage0/bin/aarch64-unknown-mingw32-ghc.exe CABAL=/home/serge/bin_x64/cabal hadrian/build "stage1.rts.cabal.configure.opts += --configure-option=--disable-large-address-space" "stage1.rts.cc.*.opts += -ffixed-x18" --bignum=native --flavour=devel2+llvm+debug_info --docs=none -j

You need a working GHC compiler (unregisterised is fine) which should be already built for Windows 11 ARM64. You could try a x86 version via win11 native emulation but the build will take a very long time to complete. Disable built-in Windows-AV-software during the build to increase its speed. Use MSYS2 ARM64 compatible environment.

Thanks @TerrorJack for the help with compiling options!

If you have no actual hardware, try to use UTM on Apple silicon with Windows 11 ARM64 installation unit.

Also need to use the most fresh Cabal to deal with Paths_* generation. The replacement of

-- win32 supported only with I386, X86_64
c_GetModuleFileName :: Ptr () -> CWString -> Int32 -> IO Int32
c_GetModuleFileName  = _

will be required on

foreign import ccall unsafe "windows.h GetModuleFileNameW"
  c_GetModuleFileName :: Ptr () -> CWString -> Int32 -> IO Int32
Edited by Serge S. Gulin

Merge request reports

Loading