haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 212 forks source link

HIE build issues (macOS) #1664

Open awave1 opened 4 years ago

awave1 commented 4 years ago

Hi,

I'm getting some build errors (again) on macOS 10.15.3 (19D76).

Here's my log output for stack ./install.hs hie-8.6.5 --verbose:

I tried re-building hie using stack clean --full and then stack ./install.hs hie-8.6.5, but still get the same error.

It seems the build fails because of this:

hie-bios          > <command line>: can't load .so/.DLL for: libargp.dylib (dlopen(libargp.dylib, 5): image not found)

I installed argp-stanalone and added -largp to LDFLAGS, unfortunately that did not help.

Also, note that building a simple project with stack works fine, e.g.

stack new temp-project --resolver lts-14.27 && cd temp-project && stack build

Any ideas why it would be failing?

mouse07410 commented 4 years ago

MacOS Mojave 10.14.6.

$ ghcup debug-info
Script version: 0.0.8

Script variables:
  GHC install location:     /Users/ur20980/.ghcup/ghc
  Binary install location:  /Users/ur20980/.ghcup/bin
  Tarball cache location:   /Users/ur20980/.ghcup/cache
  Downloader:               curl -L --fail -O <url>
  Script update url:        https://gitlab.haskell.org/haskell/ghcup/raw/master//ghcup
  GHC download baseurl:     https://downloads.haskell.org/~ghc
  Meta download url         https://gitlab.haskell.org/haskell/ghcup/raw/master//.download-urls
  Meta download format      1
  Meta version url          https://gitlab.haskell.org/haskell/ghcup/raw/master//.available-versions
  Meta version format       1

Detected system information:
  Architecture:   x86_64
  Distribution:   Darwin
  Distro alias:   darwin
  Distro version: 18.7.0
$ 

Attempt to build HIE-8.8.2 fails:

$ ./cabal-hie-install hie
. . . . .
# cabal (for hie-8.8.2)
# cabal (for hie-8.8.2)
Wrote tarball sdist to
/Users/ur20980/src/haskell-ide-engine/dist-newstyle/sdist/haskell-ide-engine-1.1.tar.gz
Wrote tarball sdist to
/Users/ur20980/src/haskell-ide-engine/dist-newstyle/sdist/hie-plugin-api-1.1.tar.gz
Wrote tarball sdist to
/Users/ur20980/src/haskell-ide-engine/dist-newstyle/sdist/cabal-helper-1.0.0.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.8.2 -O1
In order, the following will be built (use -v for more details):
 - haddock-api-2.23.0 (lib) (requires build)
 - haskell-ide-engine-1.1 (lib) (requires build)
 - haskell-ide-engine-1.1 (exe:hie) (requires build)
 - haskell-ide-engine-1.1 (exe:hie-wrapper) (requires build)
Starting     haddock-api-2.23.0 (lib)
Building     haddock-api-2.23.0 (lib)

Failed to build haddock-api-2.23.0.
Build log ( /Users/ur20980/.cabal/logs/ghc-8.8.2/hddck-p-2.23.0-575f5d80.log
):
Configuring library for haddock-api-2.23.0..
Preprocessing library for haddock-api-2.23.0..
Building library for haddock-api-2.23.0..
[ 1 of 40] Compiling Haddock.Backends.HaddockDB ( src/Haddock/Backends/HaddockDB.hs, dist/build/Haddock/Backends/HaddockDB.o )
[ 2 of 40] Compiling Haddock.Backends.Hyperlinker.Types ( src/Haddock/Backends/Hyperlinker/Types.hs, dist/build/Haddock/Backends/Hyperlinker/Types.o )
[ 3 of 40] Compiling Haddock.Backends.Xhtml.Types ( src/Haddock/Backends/Xhtml/Types.hs, dist/build/Haddock/Backends/Xhtml/Types.o )
[ 4 of 40] Compiling Haddock.Syb      ( src/Haddock/Syb.hs, dist/build/Haddock/Syb.o )
[ 5 of 40] Compiling Haddock.Types    ( src/Haddock/Types.hs, dist/build/Haddock/Types.o )
[ 6 of 40] Compiling Haddock.Parser   ( src/Haddock/Parser.hs, dist/build/Haddock/Parser.o )
[ 7 of 40] Compiling Haddock.ModuleTree ( src/Haddock/ModuleTree.hs, dist/build/Haddock/ModuleTree.o )
[ 8 of 40] Compiling Haddock.Interface.Specialize ( src/Haddock/Interface/Specialize.hs, dist/build/Haddock/Interface/Specialize.o )
[ 9 of 40] Compiling Haddock.Interface.ParseModuleHeader ( src/Haddock/Interface/ParseModuleHeader.hs, dist/build/Haddock/Interface/ParseModuleHeader.o )
[10 of 40] Compiling Haddock.Interface.LexParseRn ( src/Haddock/Interface/LexParseRn.hs, dist/build/Haddock/Interface/LexParseRn.o )
[11 of 40] Compiling Haddock.GhcUtils ( src/Haddock/GhcUtils.hs, dist/build/Haddock/GhcUtils.o )
[12 of 40] Compiling Haddock.Interface.Rename ( src/Haddock/Interface/Rename.hs, dist/build/Haddock/Interface/Rename.o )
[13 of 40] Compiling Haddock.Backends.Hyperlinker.Parser ( src/Haddock/Backends/Hyperlinker/Parser.hs, dist/build/Haddock/Backends/Hyperlinker/Parser.o )
[14 of 40] Compiling Haddock.Convert  ( src/Haddock/Convert.hs, dist/build/Haddock/Convert.o )

src/Haddock/Convert.hs:621:39: error:
    • Variable not in scope: injectiveVarsOfBinder :: TyConBinder -> FV
    • Perhaps you meant ‘injectiveVarsOfType’ (imported from TyCoRep)
    |
621 |                            mapUnionFV injectiveVarsOfBinder dropped_binders
    |                                       ^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build haddock-api-2.23.0 (which is required by exe:hie from
haskell-ide-engine-1.1 and exe:hie-wrapper from haskell-ide-engine-1.1). See
the build log above for details.

Error when running Shake build system:
  at want, called at src/Development/Shake/Internal/Args.hs:83:69 in shk-0.18.5-2738c4ee:Development.Shake.Internal.Args
* Depends on: hie
  at apply1, called at src/Development/Shake/Internal/Rules/Rerun.hs:41:5 in shk-0.18.5-2738c4ee:Development.Shake.Internal.Rules.Rerun
* Depends on: latest
  at apply1, called at src/Development/Shake/Internal/Rules/Rerun.hs:41:5 in shk-0.18.5-2738c4ee:Development.Shake.Internal.Rules.Rerun
* Depends on: hie-8.8.2
  at command, called at src/Cabal.hs:36:13 in hie-install-0.8.0.0-inplace:Cabal
* Raised the exception:
Development.Shake.command, system command failed
Command line: cabal v2-install -w /Users/ur20980/.ghcup/bin/ghc-8.8.2 --write-ghc-environment-files=never --installdir /Users/ur20980/.cabal/bin --max-backjumps=5000 exe:hie --overwrite-policy=always
Exit code: 1
Stderr:
cabal: Failed to build haddock-api-2.23.0 (which is required by exe:hie from
haskell-ide-engine-1.1 and exe:hie-wrapper from haskell-ide-engine-1.1). See
the build log above for details.

$ cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library 
$ stack --version
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.2
$ ghcup list
Available versions:
✗ ghc   7.10.3  7.10
✔ ghc   8.0.2   8.0
✗ ghc   8.2.2   8.2
✗ ghc   8.4.1
✗ ghc   8.4.2
✗ ghc   8.4.3
✗ ghc   8.4.4   8.4
✗ ghc   8.6.1   bad
✗ ghc   8.6.2
✔ ghc   8.6.3
✔ ghc   8.6.4
✔ ghc   8.6.5   recommended,8.6
✗ ghc   8.8.1
✔ ghc   8.8.2   latest,8.8
$
mouse07410 commented 4 years ago

And making it more verbose:

$ ./cabal-hie-install -v hie
. . . . .
Completed    haskell-src-exts-1.23.0 (lib)
Installing   ghc-lib-parser-8.8.2 (lib)
Completed    ghc-lib-parser-8.8.2 (lib)

Failed to build haddock-api-2.23.0.
Build log ( /Users/ur20980/.cabal/logs/ghc-8.8.2/hddck-p-2.23.0-613c5786.log
):
Configuring library for haddock-api-2.23.0..
Preprocessing library for haddock-api-2.23.0..
Building library for haddock-api-2.23.0..
[ 1 of 40] Compiling Haddock.Backends.HaddockDB ( src/Haddock/Backends/HaddockDB.hs, dist/build/Haddock/Backends/HaddockDB.o )
[ 2 of 40] Compiling Haddock.Backends.Hyperlinker.Types ( src/Haddock/Backends/Hyperlinker/Types.hs, dist/build/Haddock/Backends/Hyperlinker/Types.o )
[ 3 of 40] Compiling Haddock.Backends.Xhtml.Types ( src/Haddock/Backends/Xhtml/Types.hs, dist/build/Haddock/Backends/Xhtml/Types.o )
[ 4 of 40] Compiling Haddock.Syb      ( src/Haddock/Syb.hs, dist/build/Haddock/Syb.o )
[ 5 of 40] Compiling Haddock.Types    ( src/Haddock/Types.hs, dist/build/Haddock/Types.o )
[ 6 of 40] Compiling Haddock.Parser   ( src/Haddock/Parser.hs, dist/build/Haddock/Parser.o )
[ 7 of 40] Compiling Haddock.ModuleTree ( src/Haddock/ModuleTree.hs, dist/build/Haddock/ModuleTree.o )
[ 8 of 40] Compiling Haddock.Interface.Specialize ( src/Haddock/Interface/Specialize.hs, dist/build/Haddock/Interface/Specialize.o )
[ 9 of 40] Compiling Haddock.Interface.ParseModuleHeader ( src/Haddock/Interface/ParseModuleHeader.hs, dist/build/Haddock/Interface/ParseModuleHeader.o )
[10 of 40] Compiling Haddock.Interface.LexParseRn ( src/Haddock/Interface/LexParseRn.hs, dist/build/Haddock/Interface/LexParseRn.o )
[11 of 40] Compiling Haddock.GhcUtils ( src/Haddock/GhcUtils.hs, dist/build/Haddock/GhcUtils.o )
[12 of 40] Compiling Haddock.Interface.Rename ( src/Haddock/Interface/Rename.hs, dist/build/Haddock/Interface/Rename.o )
[13 of 40] Compiling Haddock.Backends.Hyperlinker.Parser ( src/Haddock/Backends/Hyperlinker/Parser.hs, dist/build/Haddock/Backends/Hyperlinker/Parser.o )
[14 of 40] Compiling Haddock.Convert  ( src/Haddock/Convert.hs, dist/build/Haddock/Convert.o )

src/Haddock/Convert.hs:621:39: error:
    • Variable not in scope: injectiveVarsOfBinder :: TyConBinder -> FV
    • Perhaps you meant ‘injectiveVarsOfType’ (imported from TyCoRep)
    |
621 |                            mapUnionFV injectiveVarsOfBinder dropped_binders
    |                                       ^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build haddock-api-2.23.0 (which is required by exe:hie from
haskell-ide-engine-1.1 and exe:hie-wrapper from haskell-ide-engine-1.1). See
the build log above for details.

Error when running Shake build system:
  at want, called at src/Development/Shake/Internal/Args.hs:83:69 in shk-0.18.5-a0f4ba8f:Development.Shake.Internal.Args
* Depends on: hie
  at apply1, called at src/Development/Shake/Internal/Rules/Rerun.hs:41:5 in shk-0.18.5-a0f4ba8f:Development.Shake.Internal.Rules.Rerun
* Depends on: latest
  at apply1, called at src/Development/Shake/Internal/Rules/Rerun.hs:41:5 in shk-0.18.5-a0f4ba8f:Development.Shake.Internal.Rules.Rerun
* Depends on: hie-8.8.2
  at command, called at src/Cabal.hs:36:13 in hie-install-0.8.0.0-inplace:Cabal
* Raised the exception:
Development.Shake.command, system command failed
Command line: cabal v2-install -w /Users/ur20980/.ghcup/bin/ghc-8.8.2 --write-ghc-environment-files=never --installdir /Users/ur20980/.cabal/bin --max-backjumps=5000 exe:hie --overwrite-policy=always
Exit code: 1
Stderr:
cabal: Failed to build haddock-api-2.23.0 (which is required by exe:hie from
haskell-ide-engine-1.1 and exe:hie-wrapper from haskell-ide-engine-1.1). See
the build log above for details.
alanz commented 4 years ago

As a start I would recommend using the same GHC as is installed by stack.

So something like stack setup 8.8.2, then use the GHC from the mac equivalent of ~/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.2 which I get under Debian.

mouse07410 commented 4 years ago

Is there a difference between stack setup 8.8.2 and ghcup install 8.8.2?

I'm trying to avoid keeping extraneous copies of GHC if at all possible, as reach of them takes an insane amount of disk space. And I need to have GHC available to Cabal, in addition to Stack.

Also, on a fresh install on a machine re-imaged to MacOS Catalina (again, GHC 8.6.5 and 8.8.2 were installed by ghcup), HIE installation stumbled through (after a few unsuccessful attempts) for both compilers via Stack, but only for 8.6.5 via Cabal.

jneira commented 4 years ago

Other option could be download GHC with stack and put them on $PATH to make them visible for cabal (i use that way in my windows systems)

Anyway i am setting up a azure ci job using cabal and ghc on macos 10.14, installing them with homebrew, to see if i can reproduce the error.

mouse07410 commented 4 years ago

Here's what I tried:

$ ghcup set 8.8.2
Setting GHC to 8.8.2
Done
$ stack setup 8.8.2
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
stack will use the GHC on your PATH
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
$ stack path
snapshot-doc-root: /Users/ur20980/.stack/snapshots/x86_64-osx/9e7c5fc7ad487f72383b0927f88e5a5baaff02cf696be0c5d7b94dc170455693/8.6.5/doc
local-doc-root: /Users/ur20980/.stack/global-project/.stack-work/install/x86_64-osx/9e7c5fc7ad487f72383b0927f88e5a5baaff02cf696be0c5d7b94dc170455693/8.6.5/doc
local-hoogle-root: /Users/ur20980/.stack/global-project/.stack-work/hoogle/x86_64-osx/9e7c5fc7ad487f72383b0927f88e5a5baaff02cf696be0c5d7b94dc170455693/8.6.5
stack-root: /Users/ur20980/.stack
project-root: /Users/ur20980/.stack/global-project
config-location: /Users/ur20980/.stack/global-project/stack.yaml
bin-path: /Users/ur20980/.stack/snapshots/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5/bin:/Users/ur20980/.stack/compiler-tools/x86_64-osx/ghc-8.6.5/bin:/Users/ur20980/.ghcup/ghc/8.6.5/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Library/OpenSC/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/ur20980/.cargo/bin:/Users/ur20980/.cabal/bin:/Users/ur20980/.ghcup/bin:/Users/ur20980/.local/bin:/Users/ur20980/Library/Haskell/bin:/Users/ur20980/bin:/Library/Java/NSS/bin:/Users/ur20980/go/bin:/opt/jruby/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/ur20980/Library/Python/3.7/bin:/opt/GNAT/2019/bin
programs: /Users/ur20980/.stack/programs/x86_64-osx
compiler-exe: /Users/ur20980/.ghcup/ghc/8.6.5/bin/ghc-8.6.5
compiler-bin: /Users/ur20980/.ghcup/ghc/8.6.5/bin
compiler-tools-bin: /Users/ur20980/.stack/compiler-tools/x86_64-osx/ghc-8.6.5/bin
local-bin: /Users/ur20980/.local/bin
extra-include-dirs: /opt/local/include, /usr/local/include
extra-library-dirs: /opt/local/lib/liconv, /opt/local/lib, /usr/local/lib
snapshot-pkg-db: /Users/ur20980/.stack/snapshots/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5/pkgdb
local-pkg-db: /Users/ur20980/.stack/global-project/.stack-work/install/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5/pkgdb
global-pkg-db: /Users/ur20980/.ghcup/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d
ghc-package-path: /Users/ur20980/.stack/global-project/.stack-work/install/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5/pkgdb:/Users/ur20980/.stack/snapshots/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5/pkgdb:/Users/ur20980/.ghcup/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d
snapshot-install-root: /Users/ur20980/.stack/snapshots/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5
local-install-root: /Users/ur20980/.stack/global-project/.stack-work/install/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5
dist-dir: .stack-work/dist/x86_64-osx/Cabal-2.4.0.1
local-hpc-root: /Users/ur20980/.stack/global-project/.stack-work/install/x86_64-osx/a7e6203eac8aab556a97f2c55f488b2dfee52282e9254adba6ad7b1025746b80/8.6.5/hpc
local-bin-path: /Users/ur20980/.local/bin
ghc-paths: /Users/ur20980/.stack/programs/x86_64-osx

For some reason, it seems all centered around GHC-8.6.5 and Cabal-2.4.0.1.

Screen Shot 2020-02-23 at 6 04 15 PM
mouse07410 commented 4 years ago

@alanz very same error. I've disabled using system-ghc, made stack download it's "own" GHC-8.8.2, and ran the build. Here's the complete log:

$ stack setup 8.8.2

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
snapshot-doc-root: /Users/ur20980/.stack/snapshots/x86_64-osx/246bb9fac574ce1ead442c7e11579947b977f97509b57378dc8ed42c51f4a500/8.8.2/doc
local-doc-root: /Users/ur20980/src/haskell-ide-engine/.stack-work/install/x86_64-osx/246bb9fac574ce1ead442c7e11579947b977f97509b57378dc8ed42c51f4a500/8.8.2/doc
local-hoogle-root: /Users/ur20980/src/haskell-ide-engine/.stack-work/hoogle/x86_64-osx/246bb9fac574ce1ead442c7e11579947b977f97509b57378dc8ed42c51f4a500/8.8.2
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
stack-root: /Users/ur20980/.stack
project-root: /Users/ur20980/src/haskell-ide-engine
config-location: /Users/ur20980/src/haskell-ide-engine/stack.yaml
bin-path: /Users/ur20980/.stack/snapshots/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2/bin:/Users/ur20980/.stack/compiler-tools/x86_64-osx/ghc-8.8.2/bin:/Users/ur20980/.stack/programs/x86_64-osx/ghc-8.8.2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Library/OpenSC/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/ur20980/.cargo/bin:/Users/ur20980/.cabal/bin:/Users/ur20980/.ghcup/bin:/Users/ur20980/.local/bin:/Users/ur20980/Library/Haskell/bin:/Users/ur20980/bin:/Library/Java/NSS/bin:/Users/ur20980/go/bin:/opt/jruby/bin:/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/ur20980/Library/Python/3.7/bin:/opt/GNAT/2019/bin
programs: /Users/ur20980/.stack/programs/x86_64-osx
compiler-exe: /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.8.2/bin/ghc-8.8.2
compiler-bin: /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.8.2/bin
compiler-tools-bin: /Users/ur20980/.stack/compiler-tools/x86_64-osx/ghc-8.8.2/bin
local-bin: /Users/ur20980/.local/bin
extra-include-dirs: /opt/local/include, /usr/local/include
extra-library-dirs: /opt/local/lib/liconv, /opt/local/lib, /usr/local/lib
snapshot-pkg-db: /Users/ur20980/.stack/snapshots/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2/pkgdb
local-pkg-db: /Users/ur20980/src/haskell-ide-engine/.stack-work/install/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2/pkgdb
global-pkg-db: /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
ghc-package-path: /Users/ur20980/src/haskell-ide-engine/.stack-work/install/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2/pkgdb:/Users/ur20980/.stack/snapshots/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2/pkgdb:/Users/ur20980/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
snapshot-install-root: /Users/ur20980/.stack/snapshots/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2
local-install-root: /Users/ur20980/src/haskell-ide-engine/.stack-work/install/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2
dist-dir: .stack-work/dist/x86_64-osx/Cabal-3.0.1.0
local-hpc-root: /Users/ur20980/src/haskell-ide-engine/.stack-work/install/x86_64-osx/7f95666aa519b44848684ceab2d179c9452d834c2ff221aaa6bed8c1d0a48355/8.8.2/hpc
local-bin-path: /Users/ur20980/.local/bin
ghc-paths: /Users/ur20980/.stack/programs/x86_64-osx

$ stack clean --full
$ stack ./install.sh hie

--  While building package hie-install-0.8.0.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:hie-install --ghc-options ""
    Process exited with code: ExitFailure 1
$ 

Notice that it refuses to use Cabal-3.0.1.0, but instead sticks to Cabal-2.4.0.1.

Update

Tried to force this stack-installed GHC-8.8.2 on the PATH. Same result:

$ stack clean --full
$ type ghc
ghc is /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.8.2/bin/ghc
$ stack -v --resolver lts-15.0 ./install.hs hie

--  While building package hie-install-0.8.0.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build lib:hie-install --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
$ stack -v ./install.hs hie

--  While building package hie-install-0.8.0.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:hie-install --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
$ 
jneira commented 4 years ago

Ok, the install.hs script is using another stack.yaml file: ./install/shake.yaml and it is using ghc-8.6.5. Maybe stack is not aware of your ghc-8.6.5 installation? You can try change the resolver in ./install/shake.yaml to match the one in ./stack.yaml and use ghc-8.2.2 for both, or maybe run a stack setup 8.6.5 would fix stack install.hs

mouse07410 commented 4 years ago

I'll have some projects using GHC-8.6.5, and some - using GCH-8.8.2. If I don't need two HIE builds to support them both - I'll happily use hie-8.6.5.

Changed everything to resolver: lts-15.0. Same error:

$ stack -v ./install.hs hie

--  While building package hie-install-0.8.0.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build lib:hie-install --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
$
mouse07410 commented 4 years ago

Reverted to lts-14.11:

$ stack clean --full
The same package name is used in multiple local packages

haddock-api used in:
- PLImmutable (PLIHackage (PackageIdentifier {pkgName = PackageName "haddock-api", pkgVersion = mkVersion [2,23,0]}) 2c6e61928d369e603525a0fca2a2fc4a503dc64ebadc4d497f5e5d44f09801f8,5591 (TreeKey 9b08132118bb6a7334fe65b016815be1aac17dfc16f014922c636427006774a7,4453))
- PLImmutable (PLIRepo Git repo at https://github.com/haskell/haddock.git, commit be8b02c4e3cffe7d45b3dad0a0f071d35a274d65 in subdirectory haddock-api (PackageMetadata {pmIdent = PackageIdentifier {pkgName = PackageName "haddock-api", pkgVersion = mkVersion [2,23,0]}, pmTreeKey = TreeKey 5e3a0d31b28f2e1974146a390a0f1c8ce447c640dee96365305b7c03aa22bb33,5225, pmCabal = 2c6e61928d369e603525a0fca2a2fc4a503dc64ebadc4d497f5e5d44f09801f8,5591}))

$ stack -v ./install.hs hie

--  While building package hie-install-0.8.0.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:hie-install --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
$ 
jneira commented 4 years ago

Mmm, ok, maybe building the script can give us more clues about the cause, cd ./install && stack build --stack-yaml shake.yaml gives you more info?

jneira commented 4 years ago

I've hit your initial error in azure ci using cabal-hie-install :

[14 of 40] Compiling Haddock.Convert  ( src/Haddock/Convert.hs, dist/build/Haddock/Convert.o )

src/Haddock/Convert.hs:621:39: error:
    • Variable not in scope: injectiveVarsOfBinder :: TyConBinder -> FV
    • Perhaps you meant ‘injectiveVarsOfType’ (imported from TyCoRep)
    |
621 |                            mapUnionFV injectiveVarsOfBinder dropped_binders
    |                                       ^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build haddock-api-2.23.0 (which is required by
exe:hie-wrapper from haskell-ide-engine-1.1 and exe:hie from
haskell-ide-engine-1.1). See the build log above for details.

With stack the error in your system is building the script itself (before it can start to build hie). However in ci stack install.hs latest is running succesfully: https://dev.azure.com/jneira/haskell-ide-engine/_build/results?buildId=645&view=logs&j=2c44781e-d7e7-561e-1c4f-c40434a79774&t=a65fc4e0-0c8c-5085-de03-8ce1269dc88f

jneira commented 4 years ago

To fix the installation with cabal, try add to cabal.project:

source-repository-package
    type: git
    location: https://github.com/haskell/haddock.git
    subdir: haddock-api
    tag: be8b02c4e3cffe7d45b3dad0a0f071d35a274d65

It would use a version of haddock-api fixed for ghc-8.8.2. It was not added cause it breaks the build for other ghc versions than 8.8.2

mouse07410 commented 4 years ago

Mmm, ok, maybe building the script can give us more clues about the cause, cd ./install && stack build --stack-yaml shake.yaml gives you more info?

$ cd ./install && stack build --stack-yaml shake.yaml
hie-install> build (lib)
Preprocessing library for hie-install-0.8.0.0..
Building library for hie-install-0.8.0.0..
[2 of 8] Compiling Print            ( src/Print.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Print.o )

/Users/ur20980/src/haskell-ide-engine/install/src/Print.hs:4:1: error: [-Wunused-imports, -Werror=unused-imports]
    The import of ‘Development.Shake.Command’ is redundant
      except perhaps to import instances from ‘Development.Shake.Command’
    To import instances alone, use: import Development.Shake.Command()
  |
4 | import           Development.Shake.Command
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--  While building package hie-install-0.8.0.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:hie-install --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
$ 

So, stack build consistently fails on my system.

To fix the installation with cabal, try add to cabal.project ...

That seemed to work OK, and installed a working HIE-8.8.2.

Thank you!

Update

A question: I need to be able to rebuild (when updates arrive ;) HIE for 8.6.5 and 8.8.2 (until 8.6.5 becomes obsolete). To accomplish that, should I just enable/disable that addition to cabal.project? Or is there a better way?

jneira commented 4 years ago

There is another way: you can copy the working cabal-project for ghc-8.8.2 as cabal.project-8.8.2 and install directly the main executable with cabal install hie --project-file=cabal.project-8.8.2. But you will have to copy the resultant hie as hie-8.8 and hie-8.8.2 in the same location (it is what the install script is doing, same for the ghc-8.6.5 version)

jneira commented 4 years ago

@mouse07410 About the error building the script with stack, it seems you have somewhere some config option set to pass -Wunused-imports -Werror=unused-imports (or -Wall -Werror=allor something alike) in the stack build. "somewhere" could be: ./install/hie-install.cabal, ./install/shake.yaml, $STACK_ROOT/config.yaml I cant reproduce it without setting that option in one of those files.

Anyway i am gonna correct the build script to remove the unuseds imports.

mouse07410 commented 4 years ago

... it seems you have somewhere some config option set to pass ... -Wall -Werror=all ... in the stack build.

I'm pretty sure I have -Wall in $STACK_ROOT/config.yaml - but I do not recall ever setting -Werror or -Werror=all.

Anyway i am gonna correct the build script to remove the unused import.

Thank you!!

BTW, maybe you could offer some guidance and respond to this: https://github.com/haskell/haskell-ide-engine/issues/1650#issuecomment-590144365

mouse07410 commented 4 years ago

There is another way: you can copy the working cabal-project for ghc-8.8.2 as cabal.project-8.8.2...

@jneira do you know if there's a way to have several cabal.project.* files, and have HIE (and Cabal) automatically pick the one that matches the system default?

jneira commented 4 years ago

Afaik there is no an automatic way built in cabal (and neither hie cause it follows cabal here). Cabal looks for cabal.project in the current dir and the unique way to tell use another one is with --project-file in the command line. stack does something similar here and it does not handle automatically stack-${ghcVersion}.yaml. However i am improving the install script to have in account cabal.project-${ghcVersion} and use it to install hie instead cabal.project it it exists.

mouse07410 commented 4 years ago

Afaik there is no an automatic way built in cabal (and neither hie cause it follows cabal here).

:-(

However i am improving the install script to have in account cabal.project-${ghcVersion} and use it to install hie instead cabal.project if it exists.

Thank you!!

P.S. I examined all of my global config files, and noticed that one of them had -Werror (not -Wall -Werror). Apparently that was enough to manifest the problem. I hope you apply your fix wrt. unused imports, and in the meanwhile I will pay more attention to my config files.

jneira commented 4 years ago

@awave1 hi! i have not access to a macos machine but i've changed all macos azure jobs to use macos-10.15 (instead the default 10.14) and they are all green:

awave1 commented 4 years ago

@jneira that's cool, thanks! I'll try configuring it again over the weekend and will update with the results

jneira commented 4 years ago

Sounds good, the stack install.hs hie-8.6.5 with macos-10.15 run was succesful too: https://dev.azure.com/jneira/haskell-ide-engine/_build/results?buildId=661&view=logs&j=2c44781e-d7e7-561e-1c4f-c40434a79774&t=a65fc4e0-0c8c-5085-de03-8ce1269dc88f

jneira commented 4 years ago

Duplicate imports in the install script has been removed by #1665 I've added a job to azure testing the install.hs script with cabal and macos-10.14, installing cabal and ghc with homebrew