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

cabal repl (and nix build) do not respect <package>.buildinfo #9401

Closed
AleXoundOS opened this issue Nov 6, 2023 · 3 comments · Fixed by #9440
Closed

cabal repl (and nix build) do not respect <package>.buildinfo #9401

AleXoundOS opened this issue Nov 6, 2023 · 3 comments · Fixed by #9440

Comments

@AleXoundOS
Copy link

Describe the bug
cabal build successfully builds the cabal project, which uses build-type: Configure with <package>.buildinfo and CPP definition in it.
But cabal repl fails:

$ cabal repl
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
 - cabal-buildinfo-example-0.1.0.0 (ephemeral targets)
Preprocessing library for cabal-buildinfo-example-0.1.0.0..
GHCi, version 9.2.8: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling MyLib            ( src/MyLib.hs, interpreted )

src/MyLib.hs:6:14: error:
    Data constructor not in scope: MYDEF :: String
  |
6 | definition = MYDEF
  |              ^^^^^
Failed, no modules loaded.

Remarkably, nix build fails the same way!

To Reproduce
Steps to reproduce the behavior:

$ git clone https://github.com/alexoundos/cabal-buildinfo-example
$ cd cabal-buildinfo-example
$ nix develop
[devshell]$ cabal build
[devshell]$ cabal run
[devshell]$ cabal repl

Expected behavior
Generated <project>.buildinfo file must be respected in cabal repl (and nix build).

System information

  • Operating system: tested on Linux (NixOS 23.05)
  • cabal: v3.10.1.0
  • ghc: v9.2.8

Additional context

This issue was already reported: #4195, haskell/haskell-language-server#3780.

@AleXoundOS AleXoundOS changed the title cabal repl does not respect <package>.buildinfo cabal repl (and nix build) do not respect <package>.buildinfo Nov 6, 2023
@AleXoundOS
Copy link
Author

AleXoundOS commented Nov 6, 2023

This should have been fixed in #5573. Maybe there are some caveats and workarounds?

@mpickering mpickering self-assigned this Nov 6, 2023
@mpickering
Copy link
Collaborator

I can see why this doesn't work, autoconfUserHooks doesn't set the preRepl hook. I will fix this.

What is the issue with nix build I imagine that is something different and probably related to nix packaging.

@alt-romes alt-romes assigned alt-romes and unassigned mpickering Nov 13, 2023
alt-romes added a commit to alt-romes/cabal that referenced this issue Nov 13, 2023
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Fixes haskell#9401
@alt-romes
Copy link
Collaborator

Fix in #9440

alt-romes added a commit to alt-romes/cabal that referenced this issue Dec 18, 2023
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Fixes haskell#9401
alt-romes added a commit to alt-romes/cabal that referenced this issue Dec 18, 2023
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Fixes haskell#9401
alt-romes added a commit to alt-romes/cabal that referenced this issue Dec 18, 2023
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Additionally updates `autoconfUserHooks` to read additional build info
information for the remaining pre-hooks that are not pre-conf.

Fixes haskell#9401
alt-romes added a commit to alt-romes/cabal that referenced this issue Jan 11, 2024
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Additionally updates `autoconfUserHooks` to read additional build info
information for the remaining pre-hooks that are not pre-conf.

Fixes haskell#9401
Kleidukos pushed a commit that referenced this issue Jan 12, 2024
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Additionally updates `autoconfUserHooks` to read additional build info
information for the remaining pre-hooks that are not pre-conf.

Fixes #9401
mergify bot pushed a commit that referenced this issue Jan 12, 2024
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Additionally updates `autoconfUserHooks` to read additional build info
information for the remaining pre-hooks that are not pre-conf.

Fixes #9401

(cherry picked from commit ee1e6b8)

# Conflicts:
#	Cabal/src/Distribution/Simple.hs
Kleidukos added a commit that referenced this issue Jan 12, 2024
…9440) (#9612)

* Account for .buildinfo in repl when build-type: Configure (#9440)

In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Additionally updates `autoconfUserHooks` to read additional build info
information for the remaining pre-hooks that are not pre-conf.

Fixes #9401

(cherry picked from commit ee1e6b8)

# Conflicts:
#	Cabal/src/Distribution/Simple.hs

* Update Simple.hs

---------

Co-authored-by: Rodrigo Mesquita <rodrigo.m.mesquita@gmail.com>
Co-authored-by: Hécate Moonlight <Kleidukos@users.noreply.github.com>
erikd pushed a commit to erikd/cabal that referenced this issue Apr 22, 2024
In `autoconfUserHooks` we were not updating the `preRepl` hook to read
additional build information from /package/@.buildinfo@.

Additionally updates `autoconfUserHooks` to read additional build info
information for the remaining pre-hooks that are not pre-conf.

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

Successfully merging a pull request may close this issue.

4 participants