Skip to content

ghc-lib-parser patch breaks build on GHC 9.0.2 (LTS 19.2) #1434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rimmington opened this issue Apr 9, 2022 · 2 comments
Closed

ghc-lib-parser patch breaks build on GHC 9.0.2 (LTS 19.2) #1434

rimmington opened this issue Apr 9, 2022 · 2 comments

Comments

@rimmington
Copy link

rimmington commented Apr 9, 2022

The patch to ghc-lib-parser introduced in #1311 does not seem to work on a GHC 9.0.2 build.

Workaround: add the following module

{ packages.ghc-lib-parser.patches = pkgs.lib.mkForce [];  }

Repro:

let
  haskell-nix = import (builtins.fetchTarball {
    url = "https://github.com/input-output-hk/haskell.nix/archive/5051bfa9d6b7c07d30f4d8eee23c49d9631ced7c.tar.gz";
    sha256 = "0labmjfiv5rslgw4ybgkcb18vd457aybdsh0vshf60rlz0ypnnb1";
  }) {};
  pkgs = haskell-nix.pkgs;
  pkgSet = pkgs.haskell-nix.mkStackPkgSet {
    stack-pkgs = {
      resolver = "lts-19.2";
      extras = _: {};
    };
    modules =
      # https://github.com/input-output-hk/haskell.nix/issues/1278
      # All components in the snapshot are planned
      [ { planned = true; } ];
  };
in pkgSet.config.hsPkgs.ghc-lib-parser.components.library

(Trying to build pkgs.haskell-nix.snapshots."lts-19.2".ghc-lib-parser.components.library fails much earlier trying to reinstall stm-2.5.0.0; it quite rightly complains about bounds on base; raised as #1435).

Build error:

unpacking sources
unpacking source archive /nix/store/fsz8r2qzmxlj07whjs27rk52p57yqk30-ghc-lib-parser-9.0.2.20211226.tar.gz
source root is ghc-lib-parser-9.0.2.20211226
setting SOURCE_DATE_EPOCH to timestamp 1640481001 of file ghc-lib-parser-9.0.2.20211226/ghc-lib-parser.cabal
patching sources
applying patch /nix/store/hryal633hhqw3w81nxh3a9insnyyp8m8-ghc-lib-parser-8.10-global-unique-counters-in-rts.patch
patching file compiler/cbits/genSym.c
configuring
Configure flags:
--prefix=/nix/store/vvbdaqp1jf0pn42d9944a3p4yhj41x2s-ghc-lib-parser-lib-ghc-lib-parser-9.0.2.20211226 lib:ghc-lib-parser --package-db=clear --package-db=/nix/store/a8v99pniwr72hlb43dkx9il0l8x9cdzc-ghc-lib-parser->
Warning: ghc-lib-parser.cabal:138:5: The field "autogen-modules" is available
only since the Cabal specification version 2.0. This field will be ignored.
Warning: ghc-lib-parser.cabal:1:22: Packages with 'cabal-version: 1.12' or
later should specify a specific version of the Cabal spec of the form
'cabal-version: x.y'. Use 'cabal-version: 1.22'.
Configuring library for ghc-lib-parser-9.0.2.20211226..
building
Preprocessing library for ghc-lib-parser-9.0.2.20211226..
Building library for ghc-lib-parser-9.0.2.20211226..
[...]
[264 of 264] Compiling GHC.Driver.Hooks ( compiler/GHC/Driver/Hooks.hs, dist/build/GHC/Driver/Hooks.o, dist/build/GHC/Driver/Hooks.dyn_o )
compiler/cbits/genSym.c: In function ‘ghc_lib_parser_genSym’:

compiler/cbits/genSym.c:27:9: error:
     error: ‘GenSymCounter’ undeclared (first use in this function)
       27 |         GenSymCounter = (GenSymCounter + GenSymInc) & UNIQUE_MASK;
          |         ^~~~~~~~~~~~~
   |
27 |         GenSymCounter = (GenSymCounter + GenSymInc) & UNIQUE_MASK;
   |         ^

compiler/cbits/genSym.c:27:9: error:
     note: each undeclared identifier is reported only once for each function it appears in
   |
27 |         GenSymCounter = (GenSymCounter + GenSymInc) & UNIQUE_MASK;
   |         ^

compiler/cbits/genSym.c:27:42: error:
     error: ‘GenSymInc’ undeclared (first use in this function)
       27 |         GenSymCounter = (GenSymCounter + GenSymInc) & UNIQUE_MASK;
          |                                          ^~~~~~~~~
   |
27 |         GenSymCounter = (GenSymCounter + GenSymInc) & UNIQUE_MASK;
   |                                          ^
compiler/cbits/genSym.c: In function ‘ghc_lib_parser_initGenSym’:

compiler/cbits/genSym.c:44:3: error:
     error: ‘GenSymCounter’ undeclared (first use in this function); did you mean ‘NewGenSymCounter’?
       44 |   GenSymCounter = NewGenSymCounter;
          |   ^~~~~~~~~~~~~
          |   NewGenSymCounter
   |
44 |   GenSymCounter = NewGenSymCounter;
   |   ^

compiler/cbits/genSym.c:45:3: error:
     error: ‘GenSymInc’ undeclared (first use in this function); did you mean ‘NewGenSymInc’?
       45 |   GenSymInc = NewGenSymInc;
          |   ^~~~~~~~~
          |   NewGenSymInc
   |
45 |   GenSymInc = NewGenSymInc;
   |   ^
`cc' failed in phase `C Compiler'. (Exit code: 1)
builder for '/nix/store/35sxl9hmfg8vmvp8gkk9nxzvbdiwdbnr-ghc-lib-parser-lib-ghc-lib-parser-9.0.2.20211226.drv' failed with exit code 1
@rimmington
Copy link
Author

The corresponding GHC patch is only applied to 8.10 compilers. I'm not sure if ghc-lib-parser or the GHC bounds are correct.

@rimmington
Copy link
Author

Fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant