commercialhaskell / commercialhaskell/stack

stack repl fails when main library was not yet built

Open
#4,616 5 comments 3 reactions 0 assignees View on GitHub
component: ghci type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### 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
: 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.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.