haskell / haskell-ide-engine

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

MacOS: hie fails to build with dynamic enabled #1343

Closed mouse07410 closed 5 years ago

mouse07410 commented 5 years ago

I've updated GHC from 8.6.3 to 8.6.5, and configured Cabal and Stack to build dynamically-linked executables (mainly to save vanishing disk space).

stack ./install.hs hie-8.6.5 fails:

run from: stack
# git (for submodules)
Synchronizing submodule url for 'submodules/HaRe'
Synchronizing submodule url for 'submodules/cabal-helper'
Synchronizing submodule url for 'submodules/ghc-mod'
# git (for submodules)
# stack (for check-stack)
# cabal (for cabal)
# stack (for stack-hie-8.6.5)
cabal-helper      > build (lib + exe)
cabal-helper      > Preprocessing executable 'cabal-helper-wrapper' for cabal-helper-0.9.0.0..
cabal-helper      > Building executable 'cabal-helper-wrapper' for cabal-helper-0.9.0.0..
cabal-helper      > [ 2 of 12] Compiling CabalHelper.Compiletime.Compat.ProgramDb
cabal-helper      > 
cabal-helper      > /Users/uri/src/haskell-ide-engine/submodules/cabal-helper/src/CabalHelper/Compiletime/Compat/ProgramDb.hs:10:1: error:
cabal-helper      >     Bad interface file: /Users/uri/.stack/snapshots/x86_64-osx/42f7b763edca36753ef3e49c2aea7a9e62315e6ddff7f8e1eff804d71aaff601/8.6.5/lib/x86_64-osx-ghc-8.6.5/Cabal-2.4.1.0-4t2ut7bCQNuEj8DDES6BZk/Distribution/Simple/Program.hi
cabal-helper      >         mismatched interface file ways (wanted "", got "dyn")
cabal-helper      >    |
cabal-helper      > 10 | import Distribution.Simple.Program
cabal-helper      >    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--  While building package cabal-helper-0.9.0.0 using:
      /Users/uri/src/haskell-ide-engine/submodules/cabal-helper/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:cabal-helper exe:cabal-helper-wrapper --ghc-options ""
    Process exited with code: ExitFailure 1

******************************
Building failed, Try running `stack clean` and restart the build
If this does not work, open an issue at 
    https://github.com/haskell/haskell-ide-engine
******************************

Error when running Shake build system:
  at want, called at src/Development/Shake/Internal/Args.hs:81:69 in shake-0.17.9-3kaEg6euyo2ASx128XAAyN:Development.Shake.Internal.Args
* Depends on: hie-8.6.5
  at need, called at src/HieInstall.hs:90:37 in hie-install-0.8.0.0-4D0PGWtWqSfJHezrFiF4Iw:HieInstall
* Depends on: stack-hie-8.6.5
* Raised the exception:
user error (Development.Shake.command_, system command failed
Command line: stack --stack-yaml=stack-8.6.5.yaml build
Exit code: 1
Stderr:
cabal-helper      > build (lib + exe)
cabal-helper      > Preprocessing executable 'cabal-helper-wrapper' for cabal-helper-0.9.0.0..
cabal-helper      > Building executable 'cabal-helper-wrapper' for cabal-helper-0.9.0.0..
cabal-helper      > [ 2 of 12] Compiling CabalHelper.Compiletime.Compat.ProgramDb
cabal-helper      > 
cabal-helper      > /Users/uri/src/haskell-ide-engine/submodules/cabal-helper/src/CabalHelper/Compiletime/Compat/ProgramDb.hs:10:1: error:
cabal-helper      >     Bad interface file: /Users/uri/.stack/snapshots/x86_64-osx/42f7b763edca36753ef3e49c2aea7a9e62315e6ddff7f8e1eff804d71aaff601/8.6.5/lib/x86_64-osx-ghc-8.6.5/Cabal-2.4.1.0-4t2ut7bCQNuEj8DDES6BZk/Distribution/Simple/Program.hi
cabal-helper      >         mismatched interface file ways (wanted "", got "dyn")
cabal-helper      >    |
cabal-helper      > 10 | import Distribution.Simple.Program
cabal-helper      >    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--  While building package cabal-helper-0.9.0.0 using:
      /Users/uri/src/haskell-ide-engine/submodules/cabal-helper/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build lib:cabal-helper exe:cabal-helper-wrapper --ghc-options ""
    Process exited with code: ExitFailure 1
)
samuelpilz commented 5 years ago

I fear that cabal-helper cannot be built dynamically. Afaik, dynamic linking is not officially supported by hie

mouse07410 commented 5 years ago

What would your recommendation be then? What commands should I issue to get this built/installed? Ideally - without editing ~/.cabal/config and/or ~/.stack/config.yaml?

samuelpilz commented 5 years ago

I guess there is a way to disable dynamic linking via the stack-*.yaml files or via the cabal.project file, I am not an expert and do not know what that would be. However, I do not know how well ghc-mod and the rest of hie works on projects that are dynamically linked.

mouse07410 commented 5 years ago

You're right. Forcing everything to static build via global config files - worked. Thanks!