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, please install manually" on nix #4420

Closed
teto opened this issue Nov 28, 2018 · 7 comments

Comments

@teto
Copy link

teto commented Nov 28, 2018

I must confess that whatever the tool I am completely lost in the haskell ecosystem, everything seems to fail in a different way. Ideally I would like to use nix to handle everythings but it fails in different ways as well and a website I need to modify requires stack so I gave it a spin but stack fails with I don't know how to install GHC on your system configuration, please install manually even though ghc844 is in PATH:

2018-11-28 12:46:14.289419: [debug] Checking for project config at: /home/teto/iij_website/stack.yaml
2018-11-28 12:46:14.289729: [debug] Loading project config file stack.yaml
2018-11-28 12:46:14.297751: [debug] Decoding build plan from: /home/teto/.stack/build-plan/lts-9.21.yaml
2018-11-28 12:46:14.297844: [debug] Trying to decode /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 12:46:14.300200: [debug] Success decoding /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 12:46:14.300871: [debug] PATH is: Just "/nix/store/2x6iv4zw7d3if9i549kaw0y91g8d39iy-patchelf-0.9/bin:/nix/store/wvz8gp7bhwp572jy2w1n48n1rn8wdrw3-paxctl-0.9/bin:/nix/store/10yq7kwlvbc6h658izmrlsspry1g9f3c-gcc-wrapper-7.3.0/bin:/nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/an3icm1hajqx1lld6n8q4qr40nwbs544-binutils-wrapper-2.30/bin:/nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/wjdfz57n5n1pd5b85z1xp649gibjipsl-stack-1.9.1/bin:/nix/store/s9a8h6qqdmignsqphir5jyllr5ivf0p3-ghc-8.4.4/bin:/nix/store/10yq7kwlvbc6h658izmrlsspry1g9f3c-gcc-wrapper-7.3.0/bin:/nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/an3icm1hajqx1lld6n8q4qr40nwbs544-binutils-wrapper-2.30/bin:/nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/iirmif7qgp7pgbv80z5x1sj3hbay893d-ncurses-6.1/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/y6lkznrphrb5q914my4cah6cnjcc7czw-findutils-4.6.0/bin:/nix/store/hjaa4gvr4hhhacy33l69cxk182jw36sv-diffutils-3.6/bin:/nix/store/zj5pg6bcab6b5wllj87bmws432gh4sm6-gnused-4.5/bin:/nix/store/a7pnidn0y95axmhhkpm3vh7ws54qa324-gnugrep-3.1/bin:/nix/store/h1z344s6hy8pj4qddnpkia8xwjbky48j-gawk-4.2.1/bin:/nix/store/y9nwn094yhwkg11pdl1w3427lyk9nvg3-gnutar-1.30/bin:/nix/store/gkzw2a5lygmjn7bxnj4sjr79ybg8ln47-gzip-1.9/bin:/nix/store/l2i9gmhz0rsi91mz4pvvvnvzkvi5wl6b-bzip2-1.0.6.0.1-bin/bin:/nix/store/fabhw7nzi5ij0ff3dljxnfnldgzrcqgv-gnumake-4.2.1/bin:/nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin:/nix/store/biyl7z0380bq3xzahv1yxzcikck0j7nb-patch-2.7.6/bin:/nix/store/3530yjs5jpm2qic5f0n8kdr25kmd1ncs-xz-5.2.4-bin/bin:/home/teto/rofi-scripts:/home/teto/buku_run:/home/teto/bin:/run/wrappers/bin:/home/teto/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/etc/profiles/per-user/teto/bin"
2018-11-28 12:46:14.300979: [debug] Using a nix-shell environment with nix packages: sassc, zlib, haskell.compiler.ghc802, git, gcc, gmp
2018-11-28 12:46:14.301790: [debug] Run process: /run/current-system/sw/bin/nix-shell -E "with (import <nixpkgs> {}); let inputs = [sassc zlib haskell.compiler.ghc802 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib''   ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; } \"\"" --run "'/nix/store/wjdfz57n5n1pd5b85z1xp649gibjipsl-stack-1.9.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.9.1' '-v' 'build'"
1.9.1 x86_64 hpack-0.31.1
2018-11-28 12:46:15.314704: [debug] Checking for project config at: /home/teto/iij_website/stack.yaml
2018-11-28 12:46:15.314853: [debug] Loading project config file stack.yaml
2018-11-28 12:46:15.317738: [debug] Decoding build plan from: /home/teto/.stack/build-plan/lts-9.21.yaml
2018-11-28 12:46:15.317785: [debug] Trying to decode /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 12:46:15.320672: [debug] Success decoding /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 12:46:15.320727: [debug] Getting system compiler version
2018-11-28 12:46:15.323491: [debug] Run process: /nix/store/s9a8h6qqdmignsqphir5jyllr5ivf0p3-ghc-8.4.4/bin/ghc --info
2018-11-28 12:46:15.364830: [debug] Process finished in 41ms: /nix/store/s9a8h6qqdmignsqphir5jyllr5ivf0p3-ghc-8.4.4/bin/ghc --info
2018-11-28 12:46:15.367182: [debug] Run process: /nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin/ldconfig -p
2018-11-28 12:46:15.369932: [debug] Process finished in 3ms: /nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin/ldconfig -p
2018-11-28 12:46:15.370085: [debug] Did not find shared library libtinfo.so.5
2018-11-28 12:46:15.370175: [debug] Did not find shared library libtinfo.so.6
2018-11-28 12:46:15.370254: [debug] Did not find shared library libncursesw.so.6
2018-11-28 12:46:15.370329: [debug] Did not find shared library libgmp.so.10
2018-11-28 12:46:15.370403: [debug] Did not find shared library libgmp.so.3
2018-11-28 12:46:15.370488: [debug] Potential GHC builds: 
2018-11-28 12:46:15.370553: [debug] Found already installed GHC builds: 
I don't know how to install GHC on your system configuration, please install manually

My global config is

$ cat /home/teto/.stack/config.yaml                                                                                       ~
# see https://docs.haskellstack.org/en/stable/nix_integration/#configuration
# for configuration options
nix:
  enable: true

# `pure` set to `true` means that environment variables won't get forwarded
# when running `stack build` and `stack exec`.  This is generally not what
# we want when doing day-to-day development.
  # true by default but will cause problems such as https://github.com/jaspervdj/hakyll/issues/614
  pure: false

# These are packages passed to the nix environment when running `stack
# build` or `stack exec`.  Note that `stack` will NOT be able to see a
# library that has not been passed in here.
  packages:
      - sassc
      - zlib # zlib for hakyll

while the project specific is almost empty:

resolver: lts-9.21

packages:
- .

My understanding is that $HOME/.stack/config.yaml gets merged with the project specific stack.yaml but some people on IRC disagreed and the doc isn't especially clear on this
https://docs.haskellstack.org/en/stable/yaml_configuration/

As --verbose doesn't dump options, in doubt I have append my $HOME/.stack/config.yaml to the project specific stack.yaml to no avail.

I've also tried to specify options on the command line without success:

$ stack build --nix --system-ghc --verbose
1.9.1 x86_64 hpack-0.31.1
2018-11-28 13:02:59.725822: [debug] Checking for project config at: /home/teto/iij_website/stack.yaml
2018-11-28 13:02:59.725945: [debug] Loading project config file stack.yaml
2018-11-28 13:02:59.729425: [debug] Decoding build plan from: /home/teto/.stack/build-plan/lts-9.21.yaml
2018-11-28 13:02:59.729472: [debug] Trying to decode /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 13:02:59.732069: [debug] Success decoding /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 13:02:59.732130: [debug] PATH is: Just "/nix/store/2x6iv4zw7d3if9i549kaw0y91g8d39iy-patchelf-0.9/bin:/nix/store/wvz8gp7bhwp572jy2w1n48n1rn8wdrw3-paxctl-0.9/bin:/nix/store/10yq7kwlvbc6h658izmrlsspry1g9f3c-gcc-wrapper-7.3.0/bin:/nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/an3icm1hajqx1lld6n8q4qr40nwbs544-binutils-wrapper-2.30/bin:/nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/wjdfz57n5n1pd5b85z1xp649gibjipsl-stack-1.9.1/bin:/nix/store/s9a8h6qqdmignsqphir5jyllr5ivf0p3-ghc-8.4.4/bin:/nix/store/10yq7kwlvbc6h658izmrlsspry1g9f3c-gcc-wrapper-7.3.0/bin:/nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/an3icm1hajqx1lld6n8q4qr40nwbs544-binutils-wrapper-2.30/bin:/nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin:/nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/iirmif7qgp7pgbv80z5x1sj3hbay893d-ncurses-6.1/bin:/nix/store/dzvbhkzfgwkq97ljkcvi4gs7vmflh6a0-coreutils-8.30/bin:/nix/store/y6lkznrphrb5q914my4cah6cnjcc7czw-findutils-4.6.0/bin:/nix/store/hjaa4gvr4hhhacy33l69cxk182jw36sv-diffutils-3.6/bin:/nix/store/zj5pg6bcab6b5wllj87bmws432gh4sm6-gnused-4.5/bin:/nix/store/a7pnidn0y95axmhhkpm3vh7ws54qa324-gnugrep-3.1/bin:/nix/store/h1z344s6hy8pj4qddnpkia8xwjbky48j-gawk-4.2.1/bin:/nix/store/y9nwn094yhwkg11pdl1w3427lyk9nvg3-gnutar-1.30/bin:/nix/store/gkzw2a5lygmjn7bxnj4sjr79ybg8ln47-gzip-1.9/bin:/nix/store/l2i9gmhz0rsi91mz4pvvvnvzkvi5wl6b-bzip2-1.0.6.0.1-bin/bin:/nix/store/fabhw7nzi5ij0ff3dljxnfnldgzrcqgv-gnumake-4.2.1/bin:/nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin:/nix/store/biyl7z0380bq3xzahv1yxzcikck0j7nb-patch-2.7.6/bin:/nix/store/3530yjs5jpm2qic5f0n8kdr25kmd1ncs-xz-5.2.4-bin/bin:/home/teto/rofi-scripts:/home/teto/buku_run:/home/teto/bin:/run/wrappers/bin:/home/teto/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/etc/profiles/per-user/teto/bin"
2018-11-28 13:02:59.732210: [debug] Using a nix-shell environment with nix packages: sassc, zlib, haskell.compiler.ghc802, git, gcc, gmp
2018-11-28 13:02:59.732740: [debug] Run process: /run/current-system/sw/bin/nix-shell -E "with (import <nixpkgs> {}); let inputs = [sassc zlib haskell.compiler.ghc802 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib''   ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; } \"\"" --run "'/nix/store/wjdfz57n5n1pd5b85z1xp649gibjipsl-stack-1.9.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.9.1' 'build' '--nix' '--system-ghc' '--verbose'"
1.9.1 x86_64 hpack-0.31.1
2018-11-28 13:03:00.744470: [debug] Checking for project config at: /home/teto/iij_website/stack.yaml
2018-11-28 13:03:00.744604: [debug] Loading project config file stack.yaml
2018-11-28 13:03:00.747368: [debug] Decoding build plan from: /home/teto/.stack/build-plan/lts-9.21.yaml
2018-11-28 13:03:00.747415: [debug] Trying to decode /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 13:03:00.752783: [debug] Success decoding /home/teto/.stack/build-plan-cache/lts-9.21.cache
2018-11-28 13:03:00.752862: [debug] Getting system compiler version
2018-11-28 13:03:00.753048: [debug] Run process: /nix/store/s9a8h6qqdmignsqphir5jyllr5ivf0p3-ghc-8.4.4/bin/ghc --info
2018-11-28 13:03:00.793259: [debug] Process finished in 40ms: /nix/store/s9a8h6qqdmignsqphir5jyllr5ivf0p3-ghc-8.4.4/bin/ghc --info
2018-11-28 13:03:00.794199: [debug] Run process: /nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin/ldconfig -p
2018-11-28 13:03:00.795468: [debug] Process finished in 1ms: /nix/store/340di8nn7b9a1swdhj64324l6p4bsjfp-glibc-2.27-bin/bin/ldconfig -p
2018-11-28 13:03:00.795522: [debug] Did not find shared library libtinfo.so.5
2018-11-28 13:03:00.795557: [debug] Did not find shared library libtinfo.so.6
2018-11-28 13:03:00.795588: [debug] Did not find shared library libncursesw.so.6
2018-11-28 13:03:00.795617: [debug] Did not find shared library libgmp.so.10
2018-11-28 13:03:00.795646: [debug] Did not find shared library libgmp.so.3
2018-11-28 13:03:00.795669: [debug] Potential GHC builds: 
2018-11-28 13:03:00.795692: [debug] Found already installed GHC builds: 
I don't know how to install GHC on your system configuration, please install manually

Stack version

$ stack --version
1.9.1 x86_64 hpack-0.31.1

Method of installation

via nix-shell -p stack ghc

Related #4362

@qrilka
Copy link
Contributor

qrilka commented Nov 28, 2018

@teto I have a machine with a similar setup and it appears to work so probably there's some not yet listed detail which makes Stack work incorrectly. Does Stack in impure Nix mode show you the same results? I.e. using --no-nix-pure? And if you run nix-shell command shown in the log - did you get a proper shell with ghc executable available on PATH?

@teto
Copy link
Author

teto commented Nov 28, 2018

Thanks for your answer. I find another command: stack --no-install-ghc --skip-ghc-check build which makes the process keep going but then I hit a problem my colleagues on more traditional distributions don't have:

$ stack --no-install-ghc --skip-ghc-check build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for Cabal-1.24.2.0:
    process-1.6.3.0 from stack configuration does not match >=1.1.0.1 && <1.5  (latest matching version is 1.4.3.0)
needed due to ii-web-0.1.0.0 -> Cabal-1.24.2.0

...

not sure if it's due to a mismatch in ghc versions.

@teto
Copy link
Author

teto commented Nov 28, 2018

Feel free to close as there seems to be several similar issues already open and was able to work around my problem. I feel like there is something fishy in stack ghc detection system, might be a bug/lack of verbosity/misunderstanding I am not sure.

@qrilka
Copy link
Contributor

qrilka commented Nov 28, 2018

@teto the error above points to the fact that your system GHC uses process library which is not compatible (actually not tested) with LTS-9.21. Probably you have fresh a GHC installed (version 8.4.3 maybe?) and it comes with a number of boot packages which are newer than the ones from LTS-9.21 (which is based on GHC 8.0.2) This option is not a supported configuration and it's better to use newer LTS.
Could you give some information what helped you in the end?

@teto
Copy link
Author

teto commented Nov 29, 2018

@qrilka you guessed right. I was using ghc 8.4.4 and it seemed like updating the solver to use a more recent lts was the key. Yet I am a bit sad there is not a proper error/logged message about why it discarded my ghc. I really had to try all flags while the log could have hinted at using some flags, something like: "we found ghc844 but it is not compatible with lts9 so ignoring it, use --ghc-ignore-check to bypass this".

@teto teto closed this as completed Nov 29, 2018
@freeman42x
Copy link

I had the same issue.

For some reason I had GHC 8.2.2 on path instead of GHC 8.6.4 which was defined in my configuration.nix

The fix was to remove GHC 8.2.2 from the nix store.

This put GHC 8.6.4 back on path and then stack build worked.

@acertain
Copy link

See also #4934.

--system-ghc worked for me

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

4 participants