Haskell-language-server: macos failure to build package primitive

Created on 28 Aug 2020  Â·  3Comments  Â·  Source: haskell/haskell-language-server

tried to build from source; log below, wasn't very informative unfortunately. Total haskell beginner here, hoping this is something easy to fix (did some searching but didn't find much related). Please let me know if there are any commands I can run that would provide more info

macos 10.15.5
ghc 8.10.2
stack 2.3.3

also encountered while trying to build haskell-ide-engine separately https://github.com/haskell/haskell-ide-engine/issues/1801

$ stack ./install.hs help

--  While building package primitive-0.6.4.0 using:
      /Users/wminshew/.asdf/installs/haskell/8.10.2/stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.2.0.0_ghc-8.10.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.2.0.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
Progress 14/16
build macos bug

Most helpful comment

Hi, thanks for reporting here too. The failure is thrown when stack is trying to build the install.hs script itself, before even starting to build the main project.
Could you share the output of cd install && stack build? It will try to compile the install component and hopefully it will tell us something more helpful.

I noticed the script is installed using ghc-8.10.2 but the default satck resolver in ./install/stack.yaml should build it with ghc-8.6.5
I had to change it to build it with ghc-8.10.2:

resolver: nightly-2020-08-27 # lts-14.27 # Last 8.6.5

packages:
  - .

extra-deps:
  - shake-0.18.5
  - cabal-install-parsers-0.3.0.1
  - Cabal-3.2.0.0
  - binary-instances-1.0.0.1
  - lukko-0.1.1.2

flags:
  hls-install:
    run-from-stack: true

nix:
  packages: [ icu libcxx zlib ]

did you change it that way? Note that i had to add shake-0.18.5 in extra-deps to make it work

With that ./install/stack.yaml, stack install.hs help works for me

All 3 comments

Hi, thanks for reporting here too. The failure is thrown when stack is trying to build the install.hs script itself, before even starting to build the main project.
Could you share the output of cd install && stack build? It will try to compile the install component and hopefully it will tell us something more helpful.

I noticed the script is installed using ghc-8.10.2 but the default satck resolver in ./install/stack.yaml should build it with ghc-8.6.5
I had to change it to build it with ghc-8.10.2:

resolver: nightly-2020-08-27 # lts-14.27 # Last 8.6.5

packages:
  - .

extra-deps:
  - shake-0.18.5
  - cabal-install-parsers-0.3.0.1
  - Cabal-3.2.0.0
  - binary-instances-1.0.0.1
  - lukko-0.1.1.2

flags:
  hls-install:
    run-from-stack: true

nix:
  packages: [ icu libcxx zlib ]

did you change it that way? Note that i had to add shake-0.18.5 in extra-deps to make it work

With that ./install/stack.yaml, stack install.hs help works for me

This looks like some corrupted stack build files, can you try deleting /Users/wminshew/.asdf/installs/haskell/8.10.2/stack/setup-exe-cache?

hi - thank you for the help!

removing /Users/wminshew/.asdf/installs/haskell/8.10.2/stack/setup-exe-cache didn't seem to change anything

running stack build inside install generated:

$ stack build
WARNING: Ignoring primitive's bounds on base (>=4.5 && <4.13); using base-4.14.1.0.
Reason: trusting snapshot over cabal file dependency information.
WARNING: Ignoring primitive's bounds on ghc-prim (>=0.2 && <0.6); using ghc-prim-0.6.1.
Reason: trusting snapshot over cabal file dependency information.
Linking /Users/wminshew/.asdf/installs/haskell/8.10.2/stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_3.2.0.0_ghc-8.10.2 ...
primitive  > configure
primitive  > Configuring primitive-0.6.4.0...
primitive  > build
primitive  > Preprocessing library for primitive-0.6.4.0..
primitive  > Building library for primitive-0.6.4.0..
primitive  > [ 1 of 15] Compiling Control.Monad.Primitive
primitive  > [ 2 of 15] Compiling Data.Primitive.Internal.Compat
primitive  > [ 3 of 15] Compiling Data.Primitive.Array
primitive  >
primitive  > /private/var/folders/pt/f9qvqpsx2_g1c36mryf4mdmc0000gn/T/stack-90eade93c6c643a5/primitive-0.6.4.0/Data/Primitive/Array.hs:694:3: error:
primitive  >     ‘fail’ is not a (visible) method of class ‘Monad’
primitive  >     |
primitive  > 694 |   fail _ = empty
primitive  >     |   ^^^^
primitive  >

--  While building package primitive-0.6.4.0 using:
      /Users/wminshew/.asdf/installs/haskell/8.10.2/stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.2.0.0_ghc-8.10.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.2.0.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
Progress 1/3

updating stack.yaml to include the right resolver & shake-0.18.5 worked -- thank you!

Was this page helpful?
0 / 5 - 0 ratings