Skip to content

genprimopcode invocation by Hadrian is broken for `_build/**/stage1/compiler/build/*.hs-incl`

In order to be able to run hlint on the compiler/ codebase, I need certain files to be generated beforehand, and one them is _build/stage1/compiler/build/primop-vector-uniques.hs-incl. It is then with great pleasure that I saw that Hadrian provides a rule that seemed perfectly appropriate:

_build/**/stage1/compiler/build/*.hs-incl

Alas! It would seem that the invocation of the genprimopcode executable is broken, as is shown by the following output:

[nix-shell:~/Contrib/GHC/ghc]$ hadrian/build -c -j _build/**/stage1/compiler/build/*.hs-incl
Up to date
| Run GenPrimopCode: _build/stage1/compiler/build/primops.txt => _build/**/stage1/compiler/build/*.hs-incl
genprimopcode: usage: genprimopcode command < primops.txt > ...
   where command is one of
            --data-decl
            --has-side-effects
            --out-of-line
            --commutable
            --code-size
            --can-fail
            --strictness
            --fixity
            --primop-primop-info
            --primop-tag
            --primop-list
            --primop-vector-uniques
            --primop-vector-tys
            --primop-vector-tys-exports
            --primop-vector-tycons
            --make-haskell-wrappers
            --make-haskell-source
            --make-latex-doc
            --wired-in-docs

CallStack (from HasCallStack):
  error, called at utils/genprimopcode/Main.hs:114:13 in main:Main
Error when running Shake build system:
  at want, called at src/Main.hs:102:30 in main:Main
* Depends on: _build/**/stage1/compiler/build/*.hs-incl
  at cmd', called at src/Builder.hs:266:38 in main:Builder
  at cmd, called at src/Builder.hs:380:8 in main:Builder
* Raised the exception:
Development.Shake.cmd, system command failed
Command line: _build/stage0/bin/genprimopcode
Exit code: 1
Stderr and Stdout:
genprimopcode: usage: genprimopcode command < primops.txt > ...
   where command is one of
            --data-decl
            --has-side-effects
            --out-of-line
            --commutable
            --code-size
            --can-fail
            --strictness
            --fixity
            --primop-primop-info
            --primop-tag
            --primop-list
            --primop-vector-uniques
            --primop-vector-tys
            --primop-vector-tys-exports
            --primop-vector-tycons
            --make-haskell-wrappers
            --make-haskell-source
            --make-latex-doc
            --wired-in-docs

CallStack (from HasCallStack):
  error, called at utils/genprimopcode/Main.hs:114:13 in main:Main
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information