<div dir="ltr">Hello,<div><br></div><div>I'm trying to put together a GHC 8.0.1 cross-compiler with Template Haskell support. Initially to target Windows (32bits) from a Linux host but a similar procedure should enable to target other platforms too. I'd like to contribute the patches back so I'm asking for advice on how to implement it in order to increase the chances of them being accepted.</div><div><br></div><div>I've managed to get a working stage 1 cross-compiler with some patches which correctly builds all stage1 libs and GHC + stage 2 compiler and ghc-iserv.exe. However, compiling TH by using wine and ghc-iserver.exe fails because the file descriptor ids that GHC passes as arguments to "wine ghc-iserv.exe" don't make sense in the emulated windows world.</div><div><br></div><div>I've hacked around this to test the feasibility of the approach by using stdin/stdout instead of creating new pipes and, surprisingly, managed to cross-compile a simple Template Haskell program.</div><div><br></div><div>I'm considering using a socket for communicating between both processes as a more permanent solution but this would incur in a dependency on the "network" package. Would this be acceptable?<br></div><div><br></div><div>Named pipes have also crossed my mind but I'm not sure how well they're supported by wine.</div><div><br></div><div>Thanks for your attention.</div><div>Alberto</div><div><br></div><div><br></div><div>P.S:</div><div>Code is in the "cross-mingw-hacks" branches of these repositories and is based on the ghc-8.0.1-release tag:</div><div><div><br></div><div><a href="https://github.com/albertov/ghc">https://github.com/albertov/ghc</a><br></div><div><a href="https://github.com/albertov/hsc2hs">https://github.com/albertov/hsc2hs</a><br></div><div><br></div><div>A Docker image script here that builds it is here:</div><div><br></div><div><a href="https://github.com/albertov/ghc-cross-compiler-windows-x86">https://github.com/albertov/ghc-cross-compiler-windows-x86</a><br></div></div><div><br></div><div><br></div><div><br></div></div>