snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
209 stars 37 forks source link

`happy` is not properly auto built in a fresh install #706

Closed TerrorJack closed 5 years ago

TerrorJack commented 6 years ago

Starting from a fresh checkout of ghc tree (revision 9a779d9fe05a0e6eec1db9b5c22fb5e9ae81eb91), running hadrian/build.sh --configure -j produces the following error message:

[1 of 1] Compiling Main             ( /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/setup/setup.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/setup/Main.o )

/mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/setup/setup.hs:48:22: warning: [-Wdeprecations]
    In the use of ‘rawSystemProgramConf’
    (imported from Distribution.Simple.Program):
    Deprecated: "use runDbProgram instead. This symbol will be removed in Cabal-3.0 (est. Oct 2018)."
   |
48 |   let runProgram p = rawSystemProgramConf (fromFlagOrDefault normal (buildVerbosity flags))
   |                      ^^^^^^^^^^^^^^^^^^^^
Linking /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/setup/setup ...
Warning: happy.cabal:25:2: Tabs used as indentation at 25:2, 26:2, 27:2, 28:2,
29:2, 30:2, 31:2, 32:2, 33:2, 34:2, 35:2, 36:2, 37:2, 38:2, 39:2, 40:2, 41:2,
42:2, 43:2, 44:2, 45:2, 46:2, 47:2, 48:2, 49:2, 50:2, 51:2, 52:2, 53:2, 54:2,
55:2, 56:2, 57:2, 58:2, 59:2, 60:2, 61:2, 62:2, 63:2, 64:2, 65:2, 66:2, 67:2,
68:2, 69:2, 70:2, 71:2, 72:2, 73:2, 74:2, 75:2, 76:2, 77:2, 78:2, 79:2, 80:2,
81:2, 82:2, 83:2, 84:2, 85:2, 86:2, 87:2, 88:2, 89:2, 90:2, 91:2, 92:2, 93:2,
94:2, 95:2, 96:2, 97:2, 98:2, 99:2, 100:2, 101:2, 102:2, 103:2, 104:2, 105:2,
106:2, 107:2, 108:2, 109:2, 110:2, 111:2, 112:2, 113:2, 114:2, 115:2, 116:2,
117:2, 118:2, 119:2, 120:2, 121:2, 122:2
Configuring happy-1.19.9...
Preprocessing executable 'happy' for happy-1.19.9..
Building executable 'happy' for happy-1.19.9..
[ 1 of 19] Compiling AbsSyn           ( src/AbsSyn.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/AbsSyn.o )
[ 2 of 19] Compiling GenUtils         ( src/GenUtils.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/GenUtils.o )
[ 3 of 19] Compiling NameSet          ( src/NameSet.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/NameSet.o )
[ 4 of 19] Compiling ParamRules       ( src/ParamRules.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/ParamRules.o )
[ 5 of 19] Compiling ParseMonad       ( src/ParseMonad.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/ParseMonad.o )
[ 6 of 19] Compiling Lexer            ( src/Lexer.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Lexer.o )
[ 7 of 19] Compiling AttrGrammar      ( src/AttrGrammar.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/AttrGrammar.o )
[ 8 of 19] Compiling AttrGrammarParser ( src/AttrGrammarParser.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/AttrGrammarParser.o )
[ 9 of 19] Compiling Grammar          ( src/Grammar.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Grammar.o )
[10 of 19] Compiling LALR             ( src/LALR.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/LALR.o )
[11 of 19] Compiling First            ( src/First.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/First.o )
[12 of 19] Compiling Parser           ( src/Parser.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Parser.o )
[13 of 19] Compiling Paths_happy      ( /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/autogen/Paths_happy.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Paths_happy.o )
[14 of 19] Compiling Info             ( src/Info.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Info.o )
[15 of 19] Compiling PrettyGrammar    ( src/PrettyGrammar.hs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/PrettyGrammar.o )
[16 of 19] Compiling ProduceGLRCode   ( src/ProduceGLRCode.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/ProduceGLRCode.o )
[17 of 19] Compiling Target           ( src/Target.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Target.o )
[18 of 19] Compiling ProduceCode      ( src/ProduceCode.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/ProduceCode.o )
[19 of 19] Compiling Main             ( src/Main.lhs, /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy-tmp/Main.o )
Linking /mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/build/x86_64-linux/ghc-8.4.4/happy-1.19.9/build/happy/happy ...
Warning:
/mnt/c/Users/Think/Documents/Haskell/ghc-playground/hadrian/dist-newstyle/src/happy-1.19.9/happy.cabal:25:2:
Tabs used as indentation at 25:2, 26:2, 27:2, 28:2, 29:2, 30:2, 31:2, 32:2,
33:2, 34:2, 35:2, 36:2, 37:2, 38:2, 39:2, 40:2, 41:2, 42:2, 43:2, 44:2, 45:2,
46:2, 47:2, 48:2, 49:2, 50:2, 51:2, 52:2, 53:2, 54:2, 55:2, 56:2, 57:2, 58:2,
59:2, 60:2, 61:2, 62:2, 63:2, 64:2, 65:2, 66:2, 67:2, 68:2, 69:2, 70:2, 71:2,
72:2, 73:2, 74:2, 75:2, 76:2, 77:2, 78:2, 79:2, 80:2, 81:2, 82:2, 83:2, 84:2,
85:2, 86:2, 87:2, 88:2, 89:2, 90:2, 91:2, 92:2, 93:2, 94:2, 95:2, 96:2, 97:2,
98:2, 99:2, 100:2, 101:2, 102:2, 103:2, 104:2, 105:2, 106:2, 107:2, 108:2,
109:2, 110:2, 111:2, 112:2, 113:2, 114:2, 115:2, 116:2, 117:2, 118:2, 119:2,
120:2, 121:2, 122:2
Configuring executable 'hadrian' for hadrian-0.1.0.0..
cabal: The program 'happy' version >=1.19.4 is required but it could not be
found.

I'm building it with ghc-8.4.4 and if I'm correct, alex and happy are build-tools of hadrian, so when they are not present in PATH, Cabal should build and use them automatically, but this seems to be not the case.

Does hadrian require alex, happy pre-installed, just like the legacy make-based build system? If so this should be documented.

alpmestan commented 6 years ago

I think you're using too old a Cabal version, because since 2.2 IIRC things that are in build-tool-depends are also installed automatically. Any chance this could be the problem?

TerrorJack commented 6 years ago

@alpmestan ghc-8.4.4 has Cabal-2.2.0.1 in global pkgdb, and I'm using cabal-install-2.4.0.0 compiled using Cabal-2.4.0.1, so Cabal version should be relatively new here.

alpmestan commented 6 years ago

Hmm, I'm confused then. Maybe @hvr will know?

hvr commented 6 years ago

cabal does build them; the problem is a different one: how to make them visible to ./configure so it can persist/record their locations in the config-settings.

Here's two ways which should work to query for the locations for the build-tools that were requested by hadrian.cabal:

$ cabal new-exec --project=$PWD/hadrian/cabal.project sh -- -c 'command -v alex'
/home/hvr/.cabal/store/ghc-8.4.4/alex-3.2.4-4006f020d0bf93fca9fc50e9f961c4a2af3341f7a44d2bfa6f7feb9c7d6e930b/bin/alex

or alternatively

$ cabal new-exec --project=$PWD/hadrian/cabal.project which -- alex
/home/hvr/.cabal/store/ghc-8.4.4/alex-3.2.4-4006f020d0bf93fca9fc50e9f961c4a2af3341f7a44d2bfa6f7feb9c7d6e930b/bin/alex

One thing I I've been missing from configure is support for --with-alex= and --with-happy=; in the past I temporarily modified PATH during the ./configure invocation until the locations were persisted; but that's not a precise method.

alpmestan commented 6 years ago

(@TerrorJack told me on IRC this problem is now solved.)

snowleopard commented 6 years ago

I am not sure we should consider this issue resolved.

As @hvr points out, the general solution is unclear. Others may he hit by the same problem.

adamse commented 6 years ago

Adding support for --with-(alex|happy): https://phabricator.haskell.org/D5307

adamse commented 5 years ago

We landed proper support for passing alex & happy to configure in https://gitlab.haskell.org/ghc/ghc/merge_requests/61

I’m happy to take a stab at fixing this ticket if we still want it?

snowleopard commented 5 years ago

@adamse Yes, it would be great, thank you!

Perhaps, you could open a GHC Trac ticket (or should it be a GitLab issue now?) to briefly describe the problem and proposed solution, so that it is more visible to GHC developers?

adamse commented 5 years ago

@snowleopard see https://ghc.haskell.org/trac/ghc/ticket/16120#ticket

snowleopard commented 5 years ago

@adamse Awesome, thank you! I'm therefore closing this issue.