haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
297 stars 82 forks source link

New release needed for recent GHC / Cabal versions #123

Closed glguy closed 6 years ago

glguy commented 6 years ago

Recent versions of Cabal are imposing a Cabal<1.25 constraint due to released alex's use of a Custom Setup.hs. @hvr fixed this in the repository already. To build my project using the released version of Cabal and GHC I have to add --allow-newer=alex:Cabal currently. Once a release is done we shouldn't have to do this!

alpmestan commented 6 years ago

We have the same problem in hadrian.

simonmar commented 6 years ago

I tried to make a dist today but I hit a series of errors so I'm giving up for now. Maybe @hvr can help.

Firstly cabal new-test didn't work

alex: /home/smarlow/code/alex/data//AlexWrapper-basic: openFile: does not exist (No such file or directory)

Ok, so I tried cabal new-run gen-alex-sdist, which looked like it worked

Building executable 'gen-alex-sdist' for gen-alex-sdist-0..
[1 of 1] Compiling Main             ( Main.hs, /home/smarlow/code/alex/dist-newstyle/build/x86_64-linux/ghc-8.2.2/gen-alex-sdist-0/c/gen-alex-sdist/build/gen-alex-sdist/gen-alex-sdist-tmp/Main.o )
Linking /home/smarlow/code/alex/dist-newstyle/build/x86_64-linux/ghc-8.2.2/gen-alex-sdist-0/c/gen-alex-sdist/build/gen-alex-sdist/gen-alex-sdist ...

but cabal new-test still doesn't work (same error as above).

make sdist also doesn't work:

$ make sdist
happy  -agc src/Parser.y -o src/Parser.hs
alex -g src/Scan.x -o src/Scan.hs
mv src/Parser.y src/Parser.y.boot
mv src/Scan.x src/Scan.x.boot
cabal new-run gen-alex-sdist
Up to date
cabal sdist
Warning: Cannot run preprocessors. Run 'configure' command first.
Building source dist for alex-3.2.4...
data/AlexTemplate: copyFile: does not exist (No such file or directory)Makefile:8: recipe for target 'sdist' failed

I guessed I might need a new cabal, so I built that, which took ages. make sdist now works.

But cabal new-test in the sdist now fails:

/home/smarlow/code/alex/dist-newstyle/build/x86_64-linux/ghc-8.2.2/alex-3.2.4/x/alex/build/alex/alex-tmp/Scan.hs:40:60: error:
    • Couldn't match type ‘(AlexPosn, Char, String) -> Int -> P Token’
                     with ‘Int’
      Expected type: Int
        Actual type: Action
    • Probable cause: ‘alex_action_25’ is applied to too few arguments
      In the first argument of ‘AlexAcc’, namely ‘(alex_action_25)’
      In the expression: AlexAcc (alex_action_25)
      In the second argument of ‘listArray’, namely
        ‘[AlexAccNone, AlexAcc (alex_action_25), AlexAccNone, AlexAccNone,
          ....]’

(╯°□°)╯︵ ┻━┻

hvr commented 6 years ago

I'm on it! I'll figure this out asap

hvr commented 6 years ago

@simonmar I'm having trouble reproducing the make sdist failure (which should not happen); I'm basically getting the same result that the Travis job gets at

https://travis-ci.org/simonmar/alex/jobs/358287427

Which Git commit did you try this with? I see your output mentions alex-3.2.4, but I don't see that version in the Git repo

EDIT: After a bit more experimentation, I've managed to reproduce the issue

hvr commented 6 years ago

@simonmar I believe that #124 should make things smoother for you; can you try w/ that PR locally? (i.e. by using make sdist-test)

simonmar commented 6 years ago

Thanks, that seems to have worked. I only had a local patch to bump the version to 3.2.4, so not sure what was going wrong exactly. Anyway, 3.2.4 uploaded to Hackage.

alpmestan commented 6 years ago

Thanks Simon!