alex
alex copied to clipboard
Alex build failing with missing filepath at preprocessing step
I'm not sure if it is relevant but this is on Nixos.
➜ cabal build
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- alex-3.2.7 (exe:alex) (first run)
Preprocessing executable 'alex' for alex-3.2.7..
alex: /home/solomon/Development/haskell/alex/./data//AlexTemplate-ghc: openFile: does not exist (No such file or directory)
That filepath looks odd. Any ideas what might be going wrong?
I can reproduce this with cabal build, however, stack build seems to work.
Note that this is on OSX, so it doesn't appear to be limited to nix.
I can confirm this problem on macOS Mojave.
Yes this is a very weird error. I think there is some logic in prior versions of alex to try to use newer templates? But those don't exist because we simplified the templating system.
BTW if you manually run alex on the file and delete the original Scan.hs, it will work. It is just when cabal invokes Alex that weird things happen!
Ah, this is because the autogenerated Paths_alex module allows alex_ env vars to override the data dirs. During the build those env vars are defined (at least with the latest Cabal), and thus we try to bootstrap feeding the old alex the new alex's templates! :facepalm:
More reason to finish https://github.com/simonmar/alex/pull/174, I suppose.