Skip to content

Possible regression of cross-compiling TH with mingwW64 #2314

Open
@thomasjm

Description

@thomasjm

Describe the bug

I've been trying to cross-compile a project from Linux to Windows, and noticed that several dependencies which depend on TH fail to compile in the same manner described in #1913.

There are a few examples, such as exceptions in TH code that reads from a file with file-embed, as in #1913. But for this issue I'll focus on just building aeson-typescript, where the TH doesn't even do external IO.

This is on x86_64-linux. I've tried with GHC 9.6.6 and GHC 9.8.4, which the current repro uses, and the latest Haskell.nix.

I think #2034 was meant to address these issues, but I think there might have been some regression. I'd note that the comment in overlays/wine.nix became out of date with #2034, which stopped pinning Wine. That comment mentioned Wine 5.4, but Wine on nixpkgs-unstable is up to version 10.0 now.

Steps To Reproduce

git clone [email protected]:codedownio/aeson-typescript.git
cd aeson-typescript
nix build .#windows

The build fails with a message like this (which sort of suggests a locale issue?):

       > wine: failed to open L"C:\\windows\\syswow64\\rundll32.exe": c0000135
       > wine: configuration in L"/build" has been updated.
       > Listening on port 6249
       > iserv-proxy: getBin: Unknown encoding for constructor
       > iserv-proxy-interpreter.exe:<socket:180>:hPutBuf:invalidargument(Invalid a
       > rgument)
       >
       > src/Data/Aeson/TypeScript/Instances.hs:190:25: error: [GHC-87897]
       >     • Exception when trying to run compile-time code:
       >         {handle: <file descriptor: 25>}: GHCi.Message.remoteCall: end of file
       >       Code: Language.Haskell.TH.Quote.quoteExp
       >               i "{[k: string]: #{getTypeScriptType (Proxy :: Proxy a)}}"
       >     • In the quasi-quotation:
       >         [i|{[k: string]: #{getTypeScriptType (Proxy :: Proxy a)}}|]
       >     |
       > 190 |   getTypeScriptType _ = [i|{[k: string]: #{getTypeScriptType (Proxy :: Proxy a)}}|]
       >     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       > [ 8 of 12] Compiling Data.Aeson.TypeScript.Formatting ( src/Data/Aeson/TypeScript/Formatting.hs, dist/build/Data/Aeson/TypeScript/Formatting.o )

Expected behavior

The pkgsCross.mingwW64 version of the aeson-typescript library should build successfully.

CC @amesgen and @angerman, I'd be very grateful for any help in figuring this out!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions