Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build instructions in contributing.rst are wrong #274

Open
andreasabel opened this issue Mar 19, 2024 · 10 comments
Open

Build instructions in contributing.rst are wrong #274

andreasabel opened this issue Mar 19, 2024 · 10 comments
Labels

Comments

@andreasabel
Copy link
Member

- If you *do* have an existing Happy executable on the PATH or in the default
installation location (`~/.cabal/bin` for example), do regular
::
$ cabal build
like with any other project.

On a fresh working copy of master ( 535ce96 ):

$ happy -V
Happy Version 1.20.1.1  ...

$ cabal build
....
Preprocessing library for happy-frontend-2.0...
happy: /Users/abel/project/open-source/happy-master/././HappyTemplate-arrays-coerce: openFile: does not exist (No such file or directory)
Error: [Cabal-7125]
Failed to build happy-frontend-2.0 (which is required by exe:happy from happy-2.0).

ATTN: @Ericson2314 @int-index

@int-index
Copy link
Collaborator

Sounds like an issue with the happy that you have in your $PATH. Similar issue: #262.

I can't reproduce the failure.

@andreasabel
Copy link
Member Author

Do you mean you can only bootstrap happy-2 by happy-2 ? Then maybe this should be added to the doc.

To me it looks more like happy-2 wants some template that has not been created. Maybe cabal build does not create these templates, or not at the right time?

@int-index
Copy link
Collaborator

Do you mean you can only bootstrap happy-2 by happy-2 ?

Not at all. I mean that your installation of happy-1 might be somehow misconfigured.

@andreasabel
Copy link
Member Author

Well, it is not. I use it all the time, to rebuild Agda, to test BNFC etc.

Also, the non-existing file mentioned in the error is in the domain of happy-master:

/Users/abel/project/open-source/happy-master/././HappyTemplate-arrays-coerce

@int-index wrote:

Sounds like an issue with the happy that you have in your $PATH. Similar issue: #262.

You hypothesis there was never confirmed.

And here is the counterevidence: I can exactly reproduce #262 (and my error) in a workflow:
https://github.com/haskell/happy/actions/runs/8378168492/job/22942066511?pr=275#step:6:28

happy: /home/runner/work/happy/happy/././HappyTemplate-arrays-coerce: openFile: does not exist (No such file or directory)

The workflow (c9b18cb) follows the build instructions in the manual.

Maybe your system isn't clean, that's why you cannot reproduce the issue? You might have happy-2 install artefacts lying around, maybe after running bootstrap.hs or some previous happy-2 installation.

@int-index
Copy link
Collaborator

OK, I've reproduced this on another machine. Seems to be a non-deterministic failure, sensitive to build order. Could you try this sequence of commands?

$ cabal build happy-frontend
$ cabal build

Building happy-frontend first seems to help.

@andreasabel
Copy link
Member Author

$ cabal build happy-frontend
$ cabal build

Yes this works.

But why?
Is the bootstrap turned on just if cabal build happy-frontend is invoked, and not with cabal build all or `cabal build [happy]?

flag bootstrap
description:
Optimize the implementation of happy using a pre-built happy,
and add support for attribute grammars.
manual: True
default: True

@int-index
Copy link
Collaborator

The bootstrap flag is turned on either way. You can also confirm this by specifying it manually

cabal build happy-frontend -f +bootstrap
cabal build all -f +bootstrap

@int-index
Copy link
Collaborator

The failure seems to be caused by cabal extending the environment with happy_backend_glr_datadir, happy_backend_lalr_datadir, happy_datadir, and happy_tabular_datadir.

I can reliably reproduce the failure as follows

happy_datadir="$(pwd)/./." cabal build happy-frontend

@int-index
Copy link
Collaborator

int-index commented Mar 21, 2024

Could it be a problem in cabal? Here's the version I have on the machine where the problem is reproducible

$ cabal --version
cabal-install version 3.10.2.1
compiled using version 3.10.1.0 of the Cabal library

And here's the version on the machine where I cannot reproduce the problem

$ cabal --version
cabal-install version 3.10.2.1
compiled using version 3.10.2.1 of the Cabal library

You can see that it uses a newer version of the Cabal library. It also does not extend the environment with happy_datadir.

@int-index
Copy link
Collaborator

I can reliably reproduce the failure as follows

No, I take that back. It does reproduce the problem on one machine but not on the other one. I'm lost again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants