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 keeps warning about removed modules #921

Closed
hesselink opened this Issue Sep 4, 2015 · 11 comments

Comments

Projects
None yet
5 participants
@hesselink
Contributor

hesselink commented Sep 4, 2015

I removed a few modules from a package and from the cabal file. Now stack build keeps warning about them, even though it doesn't rebuild anything. Additionally, stack ghci fails to load because it tries to load the removed modules.

$ stack build
Warning: modules not listed in manuel.cabal for library component (add to other-modules):
    Manuel.Frontend.Errors.Error
    Manuel.Frontend.Errors.ErrorDetail
    Manuel.Frontend.Errors.List

$
$ stack ghci manuel
Warning: modules not listed in manuel.cabal for library component (add to other-modules):
    Manuel.Frontend.Errors.Error
    Manuel.Frontend.Errors.ErrorDetail
    Manuel.Frontend.Errors.List
Warning: modules not listed in manuel.cabal for library component (add to other-modules):
    Manuel.Frontend.Errors.Error
    Manuel.Frontend.Errors.ErrorDetail
    Manuel.Frontend.Errors.List
Warning: modules not listed in manuel.cabal for library component (add to other-modules):
    Manuel.Frontend.Errors.Error
    Manuel.Frontend.Errors.ErrorDetail
    Manuel.Frontend.Errors.List
Using main module: Package `manuel' component exe:manuel with main-is file: /Some/path/Main.hs
Configuring GHCi with the following packages: manuel
GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
<snip loaded packages>

<command line>:
    Could not find module ‘Manuel.Frontend.Errors.Error’
    Use -v to see a list of the files searched for.

<command line>:
    Could not find module ‘Manuel.Frontend.Errors.ErrorDetail’
    Use -v to see a list of the files searched for.

<command line>:
    Could not find module ‘Manuel.Frontend.Errors.List’
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Prelude>

@snoyberg snoyberg added this to the 0.3.0.0 milestone Sep 6, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 6, 2015

@borsboom You think this could be solved with the #838 fix? It seems to be related to the same part of the codebase (determining unlisted modules).

@hesselink

This comment has been minimized.

Contributor

hesselink commented Sep 7, 2015

In the meantime, is there something I can poke at to get rid of this cached information somewhere? I'd like to avoid a full stack clean, but still be able to load the package in ghci.

@chrisdone

This comment has been minimized.

Member

chrisdone commented Sep 7, 2015

@hesselink I tested this out and I think it's fixed on master (see below). Can you confirm?

bash-3.2$ stack build
Warning: module not listed in test-project.cabal for library component (add to other-modules):
    Unlisted
test-project-0.1.0.0: build
[..]
Registering test-project-0.1.0.0...
bash-3.2$ rm src/Unlisted.hs 
bash-3.2$ echo 'module Lib where someFunc = print ()' > src/Lib.hs 
bash-3.2$ stack build
test-project-0.1.0.0: build
Preprocessing library test-project-0.1.0.0...
[1 of 1] Compiling Lib              ( src/Lib.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Lib.o )
In-place registering test-project-0.1.0.0...
Preprocessing executable 'test-project-exe' for test-project-0.1.0.0...
[1 of 1] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/test-project-exe/test-project-exe-tmp/Main.o ) [Lib changed]
Linking .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/test-project-exe/test-project-exe ...
test-project-0.1.0.0: install
Installing library in
/Users/chris/Work/stack/test-project/.stack-work/install/x86_64-osx/lts-3.3/7.10.2/lib/x86_64-osx-ghc-7.10.2/test-project-0.1.0.0-EF4qxsKSaC21Isf9vMkDQM
Installing executable(s) in
/Users/chris/Work/stack/test-project/.stack-work/install/x86_64-osx/lts-3.3/7.10.2/bin
Registering test-project-0.1.0.0...
bash-3.2$ stack ghci
test-project-0.1.0.0: unregistering (components added: test:test-project-test)
* * * * * * * *
The main module to load is ambiguous. Candidates are: 
Package `test-project' component exe:test-project-exe with main-is file: /Users/chris/Work/stack/test-project/app/Main.hs
Package `test-project' component test:test-project-test with main-is file: /Users/chris/Work/stack/test-project/test/Spec.hs
None will be loaded. You can specify which one to pick by: 
 1) Specifying targets to stack ghci e.g. stack ghci test-project:exe:test-project-exe
 2) Specifying what the main is e.g. stack ghci --main-is test-project:exe:test-project-exe
* * * * * * * *
Configuring GHCi with the following packages: test-project
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
unknown option: 'c'
[1 of 1] Compiling Lib              ( /Users/chris/Work/stack/test-project/src/Lib.hs, interpreted )
Ok, modules loaded: Lib.
*Lib> :q
Leaving GHCi.
bash-3.2$ 
@hesselink

This comment has been minimized.

Contributor

hesselink commented Sep 7, 2015

@chrisdone I'm trying, but switching to stack from master seems to make stack want to reinstall a lot of packages. The reinstall then fails due to #941, which I don't think I can work around, so for now I can't test this, sorry.

@hesselink

This comment has been minimized.

Contributor

hesselink commented Sep 7, 2015

I've tried again but ran into another issue (#944). I'll keep trying when that one has been fixed :)

@hesselink

This comment has been minimized.

Contributor

hesselink commented Sep 8, 2015

I've now been able to test this with master (Version 0.1.4.1, Git revision e2152ec X86_64). I went back to before I removed the modules, and called stack build. Then I went to after I removed them, and called stack build again. I still got the warning about missing modules once:

Warning: modules not listed in manuel.cabal for library component (add to other-modules):
    Manuel.Frontend.Errors.Error
    Manuel.Frontend.Errors.ErrorDetail
    Manuel.Frontend.Errors.List

But it built ok, and stack ghci also works. The warnings also don't reappear anymore. I'll leave it up to you if this is enough of a fix.

@chrisdone

This comment has been minimized.

Member

chrisdone commented Sep 8, 2015

Just once makes sense as it comes from the .hi files, then building updates the .hi files. So that seems ok.

@rvion

This comment has been minimized.

Contributor

rvion commented Sep 8, 2015

@hesselink that can be closed so ?

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Sep 8, 2015

Closing. #838 may end up improving the warning situation, but I'm not certain.

@snoyberg snoyberg closed this Sep 8, 2015

mgsloan added a commit that referenced this issue Feb 21, 2016

Now ghci only loads present modules #1805
+ Fully resolves #921, where unlisted module warnings were being emitted
for deleted modules
@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Feb 21, 2016

@hesselink, I pushed a commit which resolves the issue mentioned in your comment above.

@hesselink

This comment has been minimized.

Contributor

hesselink commented Feb 22, 2016

Thanks for the update!

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