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

Local package dependency ghc-pkg: cannot find package #5147

Closed
lehins opened this issue Jan 16, 2020 · 3 comments
Closed

Local package dependency ghc-pkg: cannot find package #5147

lehins opened this issue Jan 16, 2020 · 3 comments

Comments

@lehins
Copy link
Contributor

lehins commented Jan 16, 2020

General summary/comments (optional)

When one package bar has another local package foo as a dependency (either in packages or extrs-deps), rebuilding separately package foo will cause package bar erroring during build with:

ghc-pkg: cannot find package foo

Steps to reproduce

Here are two sample projects that replicate the problem: https://github.com/lehins/bugs/tree/master/haskell/stack-ghc-pkg-cannot-find-package

$ git clone https://github.com/lehins/bugs
$ cd bugs/haskell/stack-ghc-pkg-cannot-find-package
$ cd bar
$ stack build
$ cd ../foo
$ stack build
$ cd ../bar
$ stack build --force-dirty
...
Standard error:

ghc-pkg: cannot find package foo

Not 100% sure, but I think it is important that foo and bar are both on a different snapshots, but with the same ghc, eg. one is lts-14.4 another lts-14.20.

Expected

Regardless of the order packages build successfully.

Actual

Here is also a sample log with --verbose: https://github.com/lehins/bugs/blob/master/haskell/stack-ghc-pkg-cannot-find-package/output.log

Stack version

Stack version used was the latest, but I've been observing this issue since 2.0, but was unable to reproduce it reliably on small set of packages

$ stack --version
Version 2.2.0, Git revision c3c33b61a4d5c286a6718550d285305270ba4bf0 PRE-RELEASE x86_64 hpack-0.31.2

Method of installation

  • stack upgrade --git
@lehins
Copy link
Contributor Author

lehins commented Jan 30, 2020

Just ran into this bug again, but both of the packages had exactly the same resolver in them. All I did was compile bar with different ghc flags and foo would no longer build.

@lehins
Copy link
Contributor Author

lehins commented Feb 2, 2020

Here is another depiction of the same bug, I believe. Similar setup, but the error is:

setup: Cannot process the test suite 'tests' because test suites are not
enabled. Run configure with the flag --enable-tests

qrilka added a commit that referenced this issue Feb 10, 2020
This resolves issue #5147 appearing because a path for setup-config for a
package depend on OS and Cabal versions and is stored in .stack-work
inside package directory
@snoyberg
Copy link
Contributor

Fixed by #5169

qrilka added a commit that referenced this issue Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants