alex icon indicating copy to clipboard operation
alex copied to clipboard

Alex build failing with missing filepath at preprocessing step

Open solomon-b opened this issue 4 years ago • 5 comments
trafficstars

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?

solomon-b avatar Nov 05 '21 17:11 solomon-b

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.

TOTBWF avatar Nov 08 '21 18:11 TOTBWF

I can confirm this problem on macOS Mojave.

andreasabel avatar Jan 22 '22 08:01 andreasabel

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.

Ericson2314 avatar Jan 22 '22 17:01 Ericson2314

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!

Ericson2314 avatar Jan 23 '22 06:01 Ericson2314

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.

Ericson2314 avatar Jan 23 '22 07:01 Ericson2314