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

error: package id couldn't be found #238

Closed
donnut opened this issue Jun 9, 2015 · 7 comments
Closed

error: package id couldn't be found #238

donnut opened this issue Jun 9, 2015 · 7 comments
Assignees
Milestone

Comments

@donnut
Copy link

donnut commented Jun 9, 2015

Installed stack on Arch Linus. cabal and ghc are installed using nix. Running stack build in an empty directory gives the output:

No .cabal file found in directory /home/donnut/dev/haskell/test/
Writing default config file to: /home/donnut/dev/haskell/test/stack.yaml
After installing Cabal, the package id couldn't be found (via ghc-pkg describe Cabal). This shouldn't  happen, please report as a bug

I tried stack build --system-ghc, with the same result.
Running stack ghc outputs:

ghc: can't find a package database at /nix/store/dhwpkyhh5fc7093695n3bi022zfdrp3q-haskell-aeson-ghc7.8.4-0.8.0.2-shared/lib/ghc-7.8.4/package.conf.d/aeson-0.8.0.2.installedconf/

Is nix the problem here? Is it correct to say that I don't need nix anymore to use different versions of ghc?

@bitemyapp
Copy link
Contributor

@donnut if you're on Nix I wouldn't recommend attempting to use the system ghc and instead let stack use its own GHC if possible. Much of the benefit of Nix+Haskell is in caching/managing package dependencies, but if you're using Stack you're using Stackage/LTS snapshots anyway.

@snoyberg
Copy link
Contributor

snoyberg commented Jun 9, 2015

Fairly certain nix is the issue, what do you get when you run:

ghc-pkg list Cabal

Since stack uses the Cabal library to do the building, it requires it to be already present.

Also, can you try with --no-system-ghc?

If this turns out to be the issue, it would be good to get this documented in the Wiki's FAQ page.

@donnut
Copy link
Author

donnut commented Jun 10, 2015

ghc-pkg list Cabal issues a long list:
/home/donnut/.nix-profile/bin/../lib/ghc-7.8.4/package.conf.d/aeson-0.8.0.2.installedconf
...

and stack build --no-system-ghc did oke, but when I try stack ghc it outputs:

GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
ghc: can't find a package database at /nix/store/dhwpkyhh5fc7...

@snoyberg
Copy link
Contributor

You'd need to use --no-system-ghc for all commands, otherwise it will keep reverting back to the nix-installed one. Perhaps we should have a config options about whether to use the system GHC.

snoyberg added a commit that referenced this issue Jun 10, 2015
Changes default behavior to not install GHC automatically. See: #215 #238
@snoyberg
Copy link
Contributor

If you're building stack from master, you can now add system-ghc: false to ~/.stack/stack.yaml to get the desired behavior. Modifying your PATH to not include GHC will also work.

@snoyberg
Copy link
Contributor

@donnut Should we consider this issue resolved?

@snoyberg snoyberg added this to the First stable release (0.1.0.0?) milestone Jun 10, 2015
@snoyberg snoyberg self-assigned this Jun 10, 2015
@donnut
Copy link
Author

donnut commented Jun 10, 2015

Yes, it works when I keep using `--no-system-ghc.
Thanks!

@donnut donnut closed this as completed Jun 10, 2015
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

3 participants