Cross-compiling Template Haskell via -fexternal-interpreter and IPC

Phyx lonetiger at gmail.com
Wed Jul 6 18:05:53 UTC 2016


> 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.

Just as a note, On Windows we don't pass FDs (As in the posix file
descriptor) to the child process. It passes down Windows File Handles. This
requires the Windows process inheritance/security model to be implemented
in wine and I know nothing about Wine. But just wanted to clarify.

Named pipes would solve your issue, Just don't forget to set the proper ACL
on the pipes.

On Wed, Jul 6, 2016 at 2:00 PM, Alberto Valverde <alberto at toscat.net> wrote:

> Hello,
>
> 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.
>
> 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.
>
> 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.
>
> 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?
>
> Named pipes have also crossed my mind but I'm not sure how well they're
> supported by wine.
>
> Thanks for your attention.
> Alberto
>
>
> P.S:
> Code is in the "cross-mingw-hacks" branches of these repositories and is
> based on the ghc-8.0.1-release tag:
>
> https://github.com/albertov/ghc
> https://github.com/albertov/hsc2hs
>
> A Docker image script here that builds it is here:
>
> https://github.com/albertov/ghc-cross-compiler-windows-x86
>
>
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160706/2c95f8a1/attachment.html>


More information about the ghc-devs mailing list