Fix building of a Windows cross-compiler with Hadrian. First step towards #20697.
-
Fixed on Linux (tested on ArchLinux) -
check that it also fixes cross-compilation from Darwin (first commit about AR; needs someone to check that it works): cf #22805 (closed) -
check that third commit makes sense for W32 (whatever that is) and doesn't break CI
Merge request reports
Activity
added Windows backport needed:9.4 cross-compilation hadrian labels
mentioned in issue #20697
mentioned in issue #22805 (closed)
RE: Cross compilation on Darwin
ar
works, so this fixes #22805 (closed)I was able to get much further than before, however, the build failed here:
... | Run Ghc CompileHs (Stage0 InTreeLibs): utils/haddock/haddock-api/src/Haddock/Interface/Create.hs => _build/stage0/utils/haddock/build/Haddock/Interface/Create.o | Run Ghc CompileHs (Stage0 InTreeLibs): utils/haddock/haddock-api/src/Haddock/Backends/Xhtml.hs => _build/stage0/utils/haddock/build/Haddock/Backends/Xhtml.o | Run Ghc CompileHs (Stage0 InTreeLibs): utils/haddock/haddock-api/src/Haddock/Interface.hs => _build/stage0/utils/haddock/build/Haddock/Interface.o | Executable found: x86_64-w64-mingw32-ld => /opt/homebrew/bin/x86_64-w64-mingw32-ld | Package 'rts' configuration flags: configure --distdir /Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/_build/stage1/rts --disable-executable-stripping --disable-library-stripping --disable-executable-stripping --disable-library-stripping --cabal-file rts/rts.cabal --ipid $pkg-$version --prefix ${pkgroot}/.. --htmldir ${pkgroot}/../../doc/html/libraries/rts-1.0.2 --with-ghc=/Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/_build/stage0/bin/x86_64-w64-mingw32-ghc --with-ghc-pkg=/Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/_build/stage0/bin/x86_64-w64-mingw32-ghc-pkg --with-gcc=/opt/homebrew/bin/x86_64-w64-mingw32-gcc --with-ar=/opt/homebrew/bin/x86_64-w64-mingw32-ar --ghc-option=-no-global-package-db --ghc-option=-package-db=/Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/_build/stage1/inplace/package.conf.d --ghc-pkg-option=--global-package-db=/Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/_build/stage1/inplace/package.conf.d --enable-library-vanilla --enable-library-profiling --disable-library-for-ghci --disable-shared --with-ld=x86_64-w64-mingw32-ld --with-alex=/Users/romes/.cabal/bin/alex --with-happy=/Users/romes/.cabal/bin/happy --configure-option=CFLAGS=-iquote /Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/rts --gcc-options=-iquote /Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/rts --configure-option=--host=x86_64-w64-mingw32 --configure-option=--with-cc=/opt/homebrew/bin/x86_64-w64-mingw32-gcc --ghc-option=-ghcversion-file=rts/include/ghcversion.h --ghc-option=-ghcversion-file=rts/include/ghcversion.h --flags=profiling debug -dynamic threaded -use-system-libffi -libffi-adjustors -find-ptr -v0 # cabal-configure (for _build/stage1/rts/setup-config) configure: WARNING: unrecognized options: --with-compiler, --with-cc checking build system type... aarch64-apple-darwin22.1.0 checking host system type... x86_64-pc-windows Unknown OS windows Error when running Shake build system: at action, called at src/Rules.hs:38:19 in main:Rules at need, called at src/Rules.hs:60:5 in main:Rules * Depends on: _build/stage1/lib/package.conf.d/rts-1.0.2.conf at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shk-0.19.7-51192a6a:Development.Shake.Internal.Rules.Oracle * Depends on: OracleQ (ContextDataKey (Context {stage = Stage1, package = Package {pkgType = Library, pkgName = "rts", pkgPath = "rts"}, way = v, iplace = Final})) at need, called at src/Hadrian/Oracles/Cabal/Rules.hs:54:9 in main:Hadrian.Oracles.Cabal.Rules * Depends on: _build/stage1/rts/setup-config * Raised the exception: ExitFailure 1
Seems to be the first step regarding stage1 (
configure --distdir /Users/romes/ghc-dev/x86_64-w64-mingw32-ghc/_build/stage1/rts
)Edited by Rodrigo MesquitaCould you try:
diff --git m4/fptools_set_haskell_platform_vars.m4 m4/fptools_set_haskell_platform_vars.m4 index 1a32b3046b..02b5b4e53c 100644 --- m4/fptools_set_haskell_platform_vars.m4 +++ m4/fptools_set_haskell_platform_vars.m4 @@ -82,7 +82,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS_SHELL_FUNCTIONS], solaris2) test -z "[$]2" || eval "[$]2=OSSolaris2" ;; - mingw32) + mingw32|windows) test -z "[$]2" || eval "[$]2=OSMinGW32" ;; freebsd) diff --git m4/ghc_convert_os.m4 m4/ghc_convert_os.m4 index 8e2825d940..d4aa639cd5 100644 --- m4/ghc_convert_os.m4 +++ m4/ghc_convert_os.m4 @@ -22,6 +22,9 @@ AC_DEFUN([GHC_CONVERT_OS],[ openbsd*) $3="openbsd" ;; + windows) + $3="mingw32" + ;; # As far as I'm aware, none of these have relevant variants freebsd|dragonfly|hpux|linuxaout|kfreebsdgnu|freebsd2|mingw32|darwin|nextstep2|nextstep3|sunos4|ultrix|haiku) $3="$1"
@hsyl20 this patch should be a commit
I've successfully cross-compiled GHC on this (rebased) branch + that patch (on host aarch64-apple-darwin to target x86_64-w64-mingw32)
Let's try to get this merged!
added 403 commits
-
58fa3f5f...14b5982a - 399 commits from branch
ghc:master
- 77be26da - Hadrian: correctly detect AR at-file support
- be4a2ac7 - Hadrian: fix Windows cross-compilation
- bdfb4973 - Fix RTS build on Windows
- a6018e00 - configure: support "windows" as an OS
Toggle commit list-
58fa3f5f...14b5982a - 399 commits from branch
marked the checklist item check that it also fixes cross-compilation from Darwin (first commit about AR; needs someone to check that it works): cf #22805 (closed) as completed
added backport needed:9.6 label
requested review from @bgamari
- Resolved by Ben Gamari
added 28 commits
-
a6018e00...1c050ed2 - 24 commits from branch
ghc:master
- ba4a741c - Hadrian: correctly detect AR at-file support
- 546ea6b7 - Hadrian: fix Windows cross-compilation
- 3d6df963 - Fix RTS build on Windows
- 4568afa8 - configure: support "windows" as an OS
Toggle commit list-
a6018e00...1c050ed2 - 24 commits from branch
assigned to @marge-bot
I will attempt to batch this MR (!9808 (closed))...
Merged in 2fdf22ae
mentioned in merge request !9829 (closed)