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 ghci stopped work for non-default target #1269

Closed
mrkkrp opened this issue Nov 2, 2015 · 10 comments
Closed

stack ghci stopped work for non-default target #1269

mrkkrp opened this issue Nov 2, 2015 · 10 comments

Comments

@mrkkrp
Copy link
Collaborator

mrkkrp commented Nov 2, 2015

After #1222 everything was fine, but now stack ghci megaparsec:tests (that's actual project I'm working on) stopped to work with this message:

megaparsec-4.2.0: unregistering (flags changed from ["--ghc-options","-fhpc"] to [])
Using main module: Package `megaparsec' component test:tests with main-is file: /home/mark/projects/programs/haskell/megaparsec/tests/Main.hs
Configuring GHCi with the following packages: megaparsec
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package-id megaparsec-4.2.0-53ddafa5e37de955c4a6deceea8d6a20
    (use -v for more information)

stack --version returns:

Version 0.1.7.0, Git revision 31779a119bb15bfc00b1038561e55bbcdc952a7f x86_64

Why it doesn't work anymore? I've tried to clear/rebuild the whole thing but it doesn't help.

If you need log with -v option or any other information, tell me.

@mrkkrp
Copy link
Collaborator Author

mrkkrp commented Nov 2, 2015

I edited files in the project and the error has gone. Can you explain why does it happen?

@mgsloan
Copy link
Contributor

mgsloan commented Nov 2, 2015

This commit came after #1222, and changed stack ghci to always run a build, but ignore if there are failures, and optimistically. Perhaps the behavior change you're seeing is related.

That's a weird log, though, looks like it's unregistering megaparsec but not installing a new one.

Perhaps we should first do an --only-dependencies build, and not even start if there are failures. This would be followed by a build of the targets which ignores compile errors.

@borsboom
Copy link
Contributor

borsboom commented Nov 2, 2015

It seems strange that it unregistered megaparsec (due to the options change) but didn't then rebuild it before launching GHCi. Changing a file in the project probably triggered it to rebuild, but it should have done so anyway.

@mgsloan: what makes you think this particular problem had anything to do with dependencies?

@borsboom
Copy link
Contributor

borsboom commented Nov 2, 2015

I've not been able to reproduce this (using the latest stack master). I toggled between stack build --ghc-options=-fhpc and stack ghci, and it unregistered and then rebuild megaparsec as expected before launching GHCi.

@mrkkrp, can you provide any additional details, such as exactly which stack build command you ran prior to stack ghci? Even better would be a reliable reproduction.

@mgsloan
Copy link
Contributor

mgsloan commented Nov 3, 2015

@mgsloan: what makes you think this particular problem had anything to do with dependencies?

Just a theory based on the main other change to ghci since mrkkrp's last issue report. May well have nothing to do with it.

I agree that we need further details in order to work out what's going on here.

@mrkkrp
Copy link
Collaborator Author

mrkkrp commented Nov 3, 2015

I fear I myself cannot reproduce this now, sorry. I don't know what exactly made the difference so that it ceased to work. Sequence of commands was:

$ stack test # just in case, to make sure everything works
$ stack ghci megaparsec:tests

I tried to stack clean too, but it didn't make any difference. Also, I tried to delete entire .stack-work directory and re-build everything. Perhaps this is the kind of nasty bug that is there but you can't catch it (yet).

@mrkkrp
Copy link
Collaborator Author

mrkkrp commented Nov 3, 2015

Here, it happened again. I edited code in library and in tests, then
(Progress: 0/2 thing removed and ^H characters too):

$ stack ghci megaparsec:tests # there could be additional flags since it was called by haskell-mode, not directly
megaparsec-4.2.0: unregistering (local file changes: Text/Megaparsec/Expr.hs)
megaparsec-4.2.0: configure
Configuring megaparsec-4.2.0...
megaparsec-4.2.0: build
Preprocessing library megaparsec-4.2.0...
[ 1 of 15] Compiling Text.Megaparsec.ShowToken ( Text/Megaparsec/ShowToken.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/ShowToken.o )
[ 2 of 15] Compiling Text.Megaparsec.Pos ( Text/Megaparsec/Pos.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Pos.o )
[ 3 of 15] Compiling Text.Megaparsec.Error ( Text/Megaparsec/Error.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Error.o )
[ 4 of 15] Compiling Text.Megaparsec.Prim ( Text/Megaparsec/Prim.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Prim.o )
[ 5 of 15] Compiling Text.Megaparsec.ByteString ( Text/Megaparsec/ByteString.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/ByteString.o )
[ 6 of 15] Compiling Text.Megaparsec.ByteString.Lazy ( Text/Megaparsec/ByteString/Lazy.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/ByteString/Lazy.o )
[ 7 of 15] Compiling Text.Megaparsec.String ( Text/Megaparsec/String.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/String.o )
[ 8 of 15] Compiling Text.Megaparsec.Text ( Text/Megaparsec/Text.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Text.o )
[ 9 of 15] Compiling Text.Megaparsec.Text.Lazy ( Text/Megaparsec/Text/Lazy.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Text/Lazy.o )
[10 of 15] Compiling Text.Megaparsec.Combinator ( Text/Megaparsec/Combinator.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Combinator.o )
[11 of 15] Compiling Text.Megaparsec.Perm ( Text/Megaparsec/Perm.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Perm.o )
[12 of 15] Compiling Text.Megaparsec.Char ( Text/Megaparsec/Char.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Char.o )
[13 of 15] Compiling Text.Megaparsec.Lexer ( Text/Megaparsec/Lexer.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Lexer.o )
[14 of 15] Compiling Text.Megaparsec  ( Text/Megaparsec.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec.o )
[15 of 15] Compiling Text.Megaparsec.Expr ( Text/Megaparsec/Expr.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Text/Megaparsec/Expr.o )
In-place registering megaparsec-4.2.0...
megaparsec-4.2.0: copy/register
Installing library in
/home/mark/projects/programs/haskell/megaparsec/.stack-work/install/x86_64-linux/lts-3.9/7.10.2/lib/x86_64-linux-ghc-7.10.2/megaparsec-4.2.0-L1mz2n2gXa39N7fPxVB8D1
Registering megaparsec-4.2.0...
Progress: 1/2             megaparsec-4.2.0: configure (test)
Configuring megaparsec-4.2.0...
megaparsec-4.2.0: build (test)
Preprocessing library megaparsec-4.2.0...
In-place registering megaparsec-4.2.0...
Preprocessing test suite 'tests' for megaparsec-4.2.0...
[ 1 of 10] Compiling Util             ( tests/Util.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Util.o ) [Text.Megaparsec.Error changed]
[ 2 of 10] Compiling Lexer            ( tests/Lexer.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Lexer.o ) [Util changed]
[ 3 of 10] Compiling Perm             ( tests/Perm.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Perm.o ) [Util changed]
[ 4 of 10] Compiling Expr             ( tests/Expr.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Expr.o ) [Util changed]
[ 5 of 10] Compiling Char             ( tests/Char.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Char.o ) [Util changed]
[ 6 of 10] Compiling Combinator       ( tests/Combinator.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Combinator.o ) [Util changed]
[ 7 of 10] Compiling Pos              ( tests/Pos.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Pos.o ) [Text.Megaparsec.Pos changed]
[ 8 of 10] Compiling Error            ( tests/Error.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Error.o ) [Pos changed]
[ 9 of 10] Compiling Prim             ( tests/Prim.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Prim.o ) [Error changed]
[10 of 10] Compiling Main             ( tests/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests-tmp/Main.o ) [Char changed]
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/tests/tests ...
megaparsec-4.2.0: Test running disabled by --no-run-tests flag.
Completed all 2 actions.
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Using main module: Package `megaparsec' component test:tests with main-is file: /home/mark/projects/programs/haskell/megaparsec/tests/Main.hs
Configuring GHCi with the following packages: megaparsec
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package-id megaparsec-4.2.0-d04c884e367d9b1c1d5a44aab0a95a8d
    (use -v for more information)

Do you need help? I want to read code of stack to be in position to contribute something. I've read architecture.md and now I need to learn how everything works. Any recommendations where to start?

@borsboom
Copy link
Contributor

borsboom commented Nov 3, 2015

If this is still happening, can you provide stack --verbose output? This looks a bit different than the first example, because it does appear to have build the package correctly after unregistering it. Seeing exactly which arguments are being passed to stack ghci would be helpful.

We love getting help, so definitely feel free to jump into the code! The entry-point for the GHCi code is here:

(targets,mainIsTargets,pkgs) <- ghciSetup ghciBuildFirst ghciMainIs ghciTargets
. It's relatively uncomplicated, although it does call some more complicated parts (like building and loading the list of modules).

@borsboom borsboom added this to the P2: Should milestone Nov 3, 2015
@mgsloan
Copy link
Contributor

mgsloan commented Nov 3, 2015

I'd guess this has something to do with haskell/cabal#2870

It first install's the library with one package key. Then, when building the tests, it reconfigures and in-place registers a library with a different package key (In-place registering megaparsec-4.2.0...), and builds the tests against that. I'm not sure why this would affect ghci in this way, though.

I can't wait till the package key stuff gets cleaned up in ghc 8.0.... I have no idea how to tell if megaparsec-4.2.0-d04c884e367d9b1c1d5a44aab0a95a8d (from the ghci error) and megaparsec-4.2.0-L1mz2n2gXa39N7fPxVB8D1 (from the install path) are the same package.

@mgsloan
Copy link
Contributor

mgsloan commented Jan 26, 2016

This may have been fixed by 3ea8437 . Since this has lingered a while with the "need repro" label, and may now be fixed, I'm closing the issue. Feel free to open a new issue if the problem persists.

@mgsloan mgsloan closed this as completed Jan 26, 2016
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

3 participants