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

stack repl fails when main library was not yet built #4616

Open
qrilka opened this issue Mar 12, 2019 · 5 comments
Open

stack repl fails when main library was not yet built #4616

qrilka opened this issue Mar 12, 2019 · 5 comments

Comments

@qrilka
Copy link
Contributor

qrilka commented Mar 12, 2019

General summary/comments

Stack fails loading executable component if it depends on package main library and it wasn't yet built.

Steps to reproduce

  1. Check out https://github.com/qrilka/test-reexport
  2. Run command stack repl reexport:exe:reexport.

Expected

Repl should load fine.

Actual

Loading fails with

$ stack repl reexport:exe:reexport
Using main module: 1. Package `reexport' component exe:reexport with main-is file: /home/qrilka/ws/h/stack-tests/reexport/app/Main.hs
Building all executables for `reexport' once. After a successful build of all of them, only specified executables will be rebuilt.
reexport-0.1.0.0: configure (lib + exe)
Configuring reexport-0.1.0.0...
reexport-0.1.0.0: initial-build-steps (lib + exe)
Configuring GHCi with the following packages: reexport
GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package reexport-0.1.0.0
    (use -v for more information)

Stack version

$ stack --numeric-version
1.9.3

The same is on master with

$ stack-head --version
Version 1.10.0, Git revision 77aa9c36f2f29d6d6c55052a8e3918f421f00cac (dirty) (7021 commits) x86_64 hpack-0.31.1

Method of installation

  • Other - gentoo-haskell
  • Local build from master

Also it should be noted that the same works fine with cabal-install-2.4.1.0:

$ cabal new-repl reexport:exe:reexport
Resolving dependencies...
Build profile: -w ghc-8.6.3 -O1
In order, the following will be built (use -v for more details):
 - reexport-0.1.0.0 (lib) (first run)
 - reexport-0.1.0.0 (exe:reexport) (first run)
Configuring library for reexport-0.1.0.0..
Preprocessing library for reexport-0.1.0.0..
Building library for reexport-0.1.0.0..
[1 of 1] Compiling Lib              ( src/Lib.hs, /home/qrilka/ws/h/stack-tests/reexport/dist-newstyle/build/x86_64-linux/ghc-8.6.3/reexport-0.1.0.0/build/Lib.o )
Configuring executable 'reexport' for reexport-0.1.0.0..
Preprocessing executable 'reexport' for reexport-0.1.0.0..
GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/qrilka/.ghci
[1 of 1] Compiling Main             ( app/Main.hs, interpreted )
Ok, one module loaded.
λ> import RioDeJaneiro 
λ> :q
Leaving GHCi.
@snoyberg
Copy link
Contributor

Is this the same as #2790?

@snoyberg snoyberg added this to the P1: Must milestone Apr 17, 2019
@snoyberg
Copy link
Contributor

I'm putting in P1 for now, though it may get dropped to P2. I also think it may be related to component-based builds, in the sense that once we're looking at components, it should be easier to explicitly say "the library component is a dependency of the executable component." So pinging issue #4745

@jneira
Copy link
Contributor

jneira commented May 28, 2021

I think we have an issue in the haskell-language-server repo that has the same cause. As hls relies in the stack repl command to open a ghc session, bugs affecting it impact directly in users trying to load files in the ide.
Thanks for your great work, let us know if we can help to fix the issue in any way.

@jneira
Copy link
Contributor

jneira commented Aug 10, 2021

Any progress on this one? stack+hls users experience is being poor due to this, thanks!

@mpilgrem
Copy link
Member

mpilgrem commented Apr 1, 2024

I think this is still an issue with Stack 2.15.5.

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

No branches or pull requests

4 participants