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

"I don't know how to install GHC on your system configuration" #4934

Closed
chris-martin opened this issue Jul 4, 2019 · 12 comments
Closed

"I don't know how to install GHC on your system configuration" #4934

chris-martin opened this issue Jul 4, 2019 · 12 comments

Comments

@chris-martin
Copy link
Contributor

chris-martin commented Jul 4, 2019

I'm trying to come up with a workaround for the broken Nix integration in version 2.1.1.1 (#4864).

$ nix-shell -p haskell.compiler.ghc865

[nix-shell]$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5

$ stack --version | head  -n1
Version 2.1.1.1 x86_64

[nix-shell]$ stack build --resolver nightly --haddock --test --bench --no-run-benchmarks --no-nix
Selected resolver: nightly-2019-07-04
I don't know how to install GHC on your system configuration, please install manually

It seems that the version of GHC used by the resolver nightly-2019-07-04 is 8.6.5, and that also appears to be the version that is on my PATH here. Why is stack build trying to install GHC instead of using the one that is there? The error message does not explicitly state that it can't find the existing GHC installation; is that what I am supposed to infer, or is there some other reason that might trigger Stack to try to install its own? The error message is not very specific about what exactly Stack needs or where it's looking for it.

@qrilka
Copy link
Contributor

qrilka commented Jul 4, 2019

@chris-martin could you share a verbose log?
What OS do you use? The message you show looks like Nix mode just wasn't enabled for some reason

@chris-martin
Copy link
Contributor Author

chris-martin commented Jul 4, 2019

It is NixOS 19.03.

Yes, I used --no-nix to disable Nix integration in attempting to work around issue #4864, because you commented in that issue that the bug should not prevent NixOS users from using Stack if GHC is already provided.

[nix-shell]$ stack build --resolver nightly --haddock --test --bench --no-run-benchmarks --no-nix --verbose
2.1.1.1 x86_64 hpack-0.31.2
2019-07-04 01:08:43.231988: [debug] Checking for project config at: /tmp/tmp.aqSRjAD39J/foo/stack.yaml
2019-07-04 01:08:43.232269: [debug] Loading project config file stack.yaml
2019-07-04 01:08:43.244956: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2019-07-03 07:08:43.244917872 UTC]
2019-07-04 01:08:43.245207: [debug] Using resolver: nightly specified on command line
2019-07-04 01:08:43.249343: [debug] Downloading snapshot versions file from https://s3.amazonaws.com/haddock.stackage.org/snapshots.json
2019-07-04 01:08:43.741920: [debug] Done downloading and parsing snapshot versions file
2019-07-04 01:08:43.742135: [info] Selected resolver: nightly-2019-07-04
2019-07-04 01:08:43.742405: [debug] Not reading lock file
2019-07-04 01:08:43.903290: [debug] Running hpack on /tmp/tmp.aqSRjAD39J/foo/package.yaml
2019-07-04 01:08:43.905651: [debug] hpack output unchanged in /tmp/tmp.aqSRjAD39J/foo/foo.cabal
2019-07-04 01:08:43.908655: [debug] Asking for a supported GHC version
2019-07-04 01:08:43.909290: [debug] Installed tools: 
 - 
2019-07-04 01:08:43.909459: [debug] Run process: /run/current-system/sw/bin/ldconfig -p
2019-07-04 01:08:43.911390: [debug] Process finished in 2ms: /run/current-system/sw/bin/ldconfig -p
2019-07-04 01:08:43.911474: [debug] Did not find shared library libtinfo.so.5
2019-07-04 01:08:43.911551: [debug] Did not find shared library libtinfo.so.6
2019-07-04 01:08:43.911605: [debug] Did not find shared library libncursesw.so.6
2019-07-04 01:08:43.911656: [debug] Did not find shared library libgmp.so.10
2019-07-04 01:08:43.911708: [debug] Did not find shared library libgmp.so.3
2019-07-04 01:08:43.911750: [debug] Potential GHC builds: 
2019-07-04 01:08:43.911791: [debug] Found already installed GHC builds: 
2019-07-04 01:08:44.614571: [error] I don't know how to install GHC on your system configuration, please install manually

@qrilka
Copy link
Contributor

qrilka commented Jul 4, 2019

But @chris-martin #4864 is about non-project commands being run without a project context, what could it have to do with a normal stack build? If you see some new problems with nix mode - please report them.
If you want to use GHC from your PATH then there's --system-ghc flag to make it work.

@chris-martin
Copy link
Contributor Author

chris-martin commented Jul 4, 2019

Hm, I just assumed it was the same issue because I was getting exactly the same error message about Docker.

Thank you, I didn't know about the --system-ghc flag. Do you think this error message should mention it? I would imagine it could say something like:

I don't know how to install GHC on your system configuration. If you have an appropriate version of GHC installed already, you can use the --system-ghc flag to use that instead.

@chris-martin
Copy link
Contributor Author

My mistake, I do not have a new NixOS issue - you're right, I only need the workaround when running non-project commands. Once a project is initialized, I can then exit nix-shell and run with Nix integration as normal.

So my only remaining concern in this issue is I think there is an opportunity improve the error message output.

@qrilka
Copy link
Contributor

qrilka commented Jul 4, 2019

Regarding the error message there is already #4539 with a somewhat different but a similar proposal

@freeman42x
Copy link

I was getting the error because I named the file lambdabot.yaml instead of stack.yaml

[neo@nixos:~/Forks/lambdabot]$ stack build --verbose
1.9.3 x86_64 hpack-0.31.2
2019-08-19 02:50:05.893221: [debug] Checking for project config at: /home/neo/Forks/lambdabot/stack.yaml
2019-08-19 02:50:05.893472: [debug] Checking for project config at: /home/neo/Forks/stack.yaml
2019-08-19 02:50:05.893545: [debug] Checking for project config at: /home/neo/stack.yaml
2019-08-19 02:50:05.893636: [debug] Checking for project config at: /home/stack.yaml
2019-08-19 02:50:05.893742: [debug] Checking for project config at: /stack.yaml
2019-08-19 02:50:05.893799: [debug] No project config file found, using defaults.
2019-08-19 02:50:05.899524: [debug] Run from outside a project, using implicit global project config
2019-08-19 02:50:05.899915: [debug] Using resolver: lts-11.7 from implicit global project's config file: /home/neo/.stack/global-project/stack.yaml
2019-08-19 02:50:05.900035: [debug] Decoding build plan from: /home/neo/.stack/build-plan/lts-11.7.yaml
2019-08-19 02:50:05.900203: [debug] Trying to decode /home/neo/.stack/build-plan-cache/lts-11.7.cache
2019-08-19 02:50:05.906889: [debug] Success decoding /home/neo/.stack/build-plan-cache/lts-11.7.cache
2019-08-19 02:50:05.907470: [debug] Run process: /nix/store/f5wl80zkrd3fc1jxsljmnpn7y02lz6v1-glibc-2.27-bin/bin/ldconfig -p
2019-08-19 02:50:05.910335: [debug] Process finished in 3ms: /nix/store/f5wl80zkrd3fc1jxsljmnpn7y02lz6v1-glibc-2.27-bin/bin/ldconfig -p
2019-08-19 02:50:05.910451: [debug] Did not find shared library libtinfo.so.5
2019-08-19 02:50:05.910512: [debug] Did not find shared library libtinfo.so.6
2019-08-19 02:50:05.910568: [debug] Did not find shared library libncursesw.so.6
2019-08-19 02:50:05.910655: [debug] Did not find shared library libgmp.so.10
2019-08-19 02:50:05.910711: [debug] Did not find shared library libgmp.so.3
2019-08-19 02:50:05.910768: [debug] Potential GHC builds: 
2019-08-19 02:50:05.910814: [debug] Found already installed GHC builds: 
I don't know how to install GHC on your system configuration, please install manually

@delirehberi
Copy link

Add ghc-build: standard to your global stack config.

@locallycompact
Copy link

Add ghc-build: standard to your global stack config.

For me this results in

Stack has not been tested with GHC versions above 9.0, and using 9.2.1, this may fail
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
gcc: error: unrecognized command-line option '--target=x86_64-unknown-linux'
utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist: line 3: /home/lc/.stack/programs/x86_64-linux-nix/ghc-9.2.1.temp/ghc-9.2.1/utils/ghc-cabal/dist-install/build/tmp/ghc-cabal: No such file or directory
make[1]: *** [ghc.mk:986: install_packages] Error 127
make: *** [Makefile:51: install] Error 2
Received ExitFailure 2 when running
Raw command: /nix/store/d8wfismlyvyw766a3wxkxmbbfbcr6b7f-gnumake-4.3/bin/make install
Run from: /home/lc/.stack/programs/x86_64-linux-nix/ghc-9.2.1.temp/ghc-9.2.1/


Error: Error encountered while installing GHC with
         make install
         run in /home/lc/.stack/programs/x86_64-linux-nix/ghc-9.2.1.temp/ghc-9.2.1/

       The following directories may now contain files, but won't be used by stack:
         - /home/lc/.stack/programs/x86_64-linux-nix/ghc-9.2.1.temp/
         - /home/lc/.stack/programs/x86_64-linux-nix/ghc-9.2.1/

       For more information consider rerunning with --verbose flag

@if-loop69420
Copy link

I am having the same problem with this resulting in an error

@mpilgrem
Copy link
Member

@if-loop69420, although you say that it is the same problem, given the passage of time since the initial post, if you could post details of what you are doing and what you are experiencing, that would assist.

@mpilgrem
Copy link
Member

mpilgrem commented Apr 1, 2024

I am going to close this issue given the passage of time.

@mpilgrem mpilgrem closed this as completed Apr 1, 2024
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

7 participants