tweag/ormolu

Ormolu.Fixity doesn't compile

bjornkihlberg opened this issue · 3 comments

Describe the bug
Ormolu.Fixity doesn't compile with cabal build.

ormolu> cabal build
Build profile: -w ghc-9.8.1 -O1
In order, the following will be built (use -v for more details):
 - ormolu-0.7.4.0 (lib) (first run)
 - ormolu-0.7.4.0 (exe:ormolu) (first run)
Preprocessing library for ormolu-0.7.4.0..
Building library for ormolu-0.7.4.0..
[14 of 55] Compiling Ormolu.Fixity    ( src\Ormolu\Fixity.hs, C:\Users\hoppf\Documents\repos\ormolu\dist-newstyle\build\x86_64-windows\ghc-9.8.1\ormolu-0.7.4.0\build\Ormolu\Fixity.o )

Access violation in generated code when executing data at 0x7ff61fefd018

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0x8f9a8fd8a0 0x7ff61fefd018
 * 0x8f9a8fd8a8 0x7ff617bf004b C:\ghcup\ghc\9.8.1\lib\x86_64-windows-ghc-9.8.1\base-4.19.0.0-1e7d\libHSbase-4.19.0.0-1e7d.a(#10:fs.o)+0x3b
                 (__hs_swopen+0x295)
 * 0x8f9a8fd8b0 0x100
 * 0x8f9a8fd8b8 0x80000000
 * 0x8f9a8fd8c0 0x7ef4be424f90
 * 0x8f9a8fd8c8 0x7ef4be41ce78
 * 0x8f9a8fd8d0 0x1
 * 0x8f9a8fd8d8 0x22b71c0f880

Error: cabal-3.10.2.1.exe: Failed to build ormolu-0.7.4.0 (which is required
by exe:ormolu from ormolu-0.7.4.0). The build process terminated with exit
code 11

To Reproduce

Run cabal build

Expected behavior

Project compiles.

Environment

  • OS name + version: Windows 10.
  • Version of the code: latest from master branch

Hmm, Ormolu.Fixity uses Template Haskell, maybe that is the culprit:

BL.fromStrict $(embedFile "extract-hackage-info/hackage-info.bin")

Just to debug: Can you try to replace this line with

    BL.fromStrict ""

just to see whether that allows compilation to succeed?

@amesgen Yes, it compiles with your suggested change.

I don't think this is a problem with your project, I think this is a problem with GHC and Windows and it seems to be recurring.

Thanks for confirming! As the problem indeed seems to be independent of Ormolu, I will close this issue then, but in case you find a solution feel free to post it here (maybe other people run into the same thing).

Also just FTR: We have prebuilt Windows binaries on our release page: https://github.com/tweag/ormolu/releases/tag/0.7.4.0