Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Update for GHC 8.2.x #922

Merged
merged 1 commit into from
Dec 29, 2017
Merged

Update for GHC 8.2.x #922

merged 1 commit into from
Dec 29, 2017

Conversation

ariskou
Copy link
Contributor

@ariskou ariskou commented Dec 23, 2017

Hi,
as an extension of the work in PR #911 working on issue #900 for supporting GHC 8.2.x, I have made some small, almost mechanical changes.
These changes in combination with the current cabal-helper:master (DanielG/cabal-helper@4bfc6b9) yield a working ghc-mod for GHC 8.2.2, which I have been using for a few weeks now, via the atom plugin.

@m4lvin
Copy link

m4lvin commented Dec 25, 2017

Great! Could you give or link to some instructions how to compile this? Do we need to build ghc-mod itself with ghc 8.2.2 to be usable with ghc 8.2.2 / stackage lts-10 projects?

@ariskou
Copy link
Contributor Author

ariskou commented Dec 25, 2017

I'm not sure about needing to compile ghc-mod with GHC 8.2.2 / stackage lts-10. But the way I tested it is with GHC 8.2.2 / stackage lts-10 and that's also how I work on my projects.
In order to get it to compile, an easy way is with stack. Do the following (I'm assuming a Linux environment):

  1. Make a temporary directory, e.g. mkdir /tmp/build
  2. Enter the directory: cd /tmp/build
  3. Checkout my branch: git clone git@github.com:ariskou/ghc-mod.git -b ghc802
  4. Checkout the master branch for cabal-helper: git clone https://github.com/DanielG/cabal-helper.git
  5. Enter the ghc-mod directory: cd ghc-mod
  6. Create a stack.yaml file with the contents:
resolver: lts-10.0

packages:
- location: .
- location: ../cabal-helper
  extra-dep: true

extra-deps: 
- extra-1.5.3
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0
- unix-compat-0.4.3.1
- either-4.4.1.1

                
flags: {}

extra-package-dbs: []

  1. Run stack build. You should get working ghc-mod binary somewhere in the .stack-work subdirectory.

@m4lvin
Copy link

m4lvin commented Dec 26, 2017

Thank you! Such a stack.yaml file was exactly what I was looking for and the result works perfectly with atom 😃

@ariskou
Copy link
Contributor Author

ariskou commented Dec 26, 2017

Great, happy to oblige!
BTW, as a long-time invisible user of ghc-mod, thanks for all your great work!

@dmvianna
Copy link

Works for me. lts-10.1

@HeapUnderfl0w
Copy link

I can confirm that this compiles and works on Windows 10 x64 Version 1709
No adjustments had to be made to the directions of @ariskou

Versions:

stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0

cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library

ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2

Tested with Visual Studio Code

code --version
1.19.1
0759f77bb8d86658bc935a10a64f6182c5a1eeba
x64

Plugin
hoovercj.vscode-ghc-mod 1.2.0

@jasigal
Copy link

jasigal commented Dec 27, 2017

I can confirm that this worked on Ubuntu 17.04 with no modifications.

Versions (with ghc --version being run via stack exec):

stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library
ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2

And now ghc-mod works properly with the Atom packages haskell-ghc-mod 2.1.3 and others, with version

atom --version
Atom    : 1.19.0
Electron: 1.6.9
Chrome  : 56.0.2924.87
Node    : 7.4.0

Thank you @ariskou! I needed ghc-mod compiled with 8.2.2 in order for the Atom plugin to actually function.

@mrkgnao mrkgnao mentioned this pull request Dec 28, 2017
Copy link
Owner

@DanielG DanielG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, we got so tied up making cabal-helper (sorta) work with backpack stuff we forgot to push these changes back to ghc-mod. I could have sworn @alanz had a PR for pretty much this lying around but it seems not.

Anyways great to get some early testing regardless :)

PS: Just FYI you forgot to update the dependency bounds in the cabal file. Never mind, I was looking at the wrong branch.

return ([setupConfigPath distdir], cs)
cs <- runCHQuery $ components $
GmComponent mempty
CH.<$> ghcOptions
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CH. qualifier shouldn't be required here, any particular reason you put those there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a leftover from trying to get it to compile :) Sorry

@DanielG DanielG merged commit bf08e35 into DanielG:ghc802 Dec 29, 2017
@alanz
Copy link
Collaborator

alanz commented Dec 29, 2017

I did have this change, and still do, as used in hie.

But @DanielG asked me to split the PR and only bring it in once cabal-helper is done. Which is now in limbo.

@megafinz
Copy link

megafinz commented Jan 19, 2018

As of today, cabal-helper has been updated and build no longer works. Specific revision is needed (see first comment): DanielG/cabal-helper@4bfc6b9

@DanielG
Copy link
Owner

DanielG commented Jan 19, 2018

What are you talking about? Builds just fine in CI: https://gitlab.com/dxld/cabal-helper/pipelines/16348275

@megafinz
Copy link

megafinz commented Jan 19, 2018

Sorry, I mean the ghc-mod build. ChLibEntryPoint signature has been changed and ariskou's ghc-mod branch no longer compiles.

@alanz
Copy link
Collaborator

alanz commented Jan 19, 2018

Try this one https://github.com/alanz/ghc-mod/tree/ghc802-ch8.0 in the meantime.

There should be a fuller update soon

@BlackCapCoder
Copy link

@megafinz Change line 370 in core/GhcMod/Target.hs from

resolveChEntrypoints _ (ChLibEntrypoint em om) =

to:

resolveChEntrypoints _ (ChLibEntrypoint em om _) =

@asheshambasta
Copy link

Unfortunately, this still doesn't work on Mac OS;
stack build exits with:

cpphs-1.20.8: copy/register
Progress: 11/24
semigroupoids-5.2.1: copy/register
cabal-install-2.0.0.1: copy/register
Progress: 13/24
--  While building custom Setup.hs for package pipes-4.3.7 using:
      /Users/asheshambasta/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/tmp/build/ghc-mod/.stack-work/logs/pipes-4.3.7.log

    Configuring pipes-4.3.7...
    Preprocessing library for pipes-4.3.7..
    Building library for pipes-4.3.7..
    <command line>: cannot satisfy -package-id exceptions-0.8.3-IMG8z9bQ0kKKt0LCvLfr9v:
        exceptions-0.8.3-IMG8z9bQ0kKKt0LCvLfr9v is unusable due to shadowed dependencies:
          mtl-2.2.1-DscMMmDQUE6GBfOSl4qMUH
        (use -v for more information)


--  While building custom Setup.hs for package temporary-1.2.1.1 using:
      /Users/asheshambasta/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/tmp/build/ghc-mod/.stack-work/logs/temporary-1.2.1.1.log

    Configuring temporary-1.2.1.1...
    Preprocessing library for temporary-1.2.1.1..
    Building library for temporary-1.2.1.1..
    <command line>: cannot satisfy -package-id exceptions-0.8.3-IMG8z9bQ0kKKt0LCvLfr9v:
        exceptions-0.8.3-IMG8z9bQ0kKKt0LCvLfr9v is unusable due to shadowed dependencies:
          mtl-2.2.1-DscMMmDQUE6GBfOSl4qMUH
        (use -v for more information)


--  While building custom Setup.hs for package resourcet-1.1.10 using:
      /Users/asheshambasta/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/tmp/build/ghc-mod/.stack-work/logs/resourcet-1.1.10.log

    Configuring resourcet-1.1.10...
    Preprocessing library for resourcet-1.1.10..
    Building library for resourcet-1.1.10..
    <command line>: cannot satisfy -package-id mmorph-1.1.0-1S4lM6skb3zDTw2xDs9NDW:
        mmorph-1.1.0-1S4lM6skb3zDTw2xDs9NDW is unusable due to shadowed dependencies:
          mtl-2.2.1-DscMMmDQUE6GBfOSl4qMUH
        (use -v for more information)

@coquizen
Copy link

coquizen commented Mar 6, 2018

@asheshambasta: Have you tried DanielG's suggestion? Works for me.

@peterstorm
Copy link

Where do I put the compiled ghc-mod then?

@m4lvin
Copy link

m4lvin commented Mar 15, 2018

@peterstorm: into any directory that is in your $PATH, for example this should include ~/.local/bin where stack also installs binaries.

@peterstorm
Copy link

@m4lvin Ah yes, figured it out, thank you :) It works now, awesome!

@ayelich
Copy link

ayelich commented Mar 16, 2018

I have this problem?

stack build

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

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0)
    base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0)
    cabal-helper-0.8.0.2 from stack configuration does not match <0.8 && >=0.7.3.0 (latest matching version is 0.7.3.0)
    ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
needed since ghc-mod is a build target.

Some potential ways to resolve this:

  * Recommended action: try adding the following to your extra-deps in /tmp/build/ghc-mod/stack.yaml:

- Cabal-1.24.2.0
- base-4.9.1.0
- cabal-helper-0.7.3.0

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * You may also want to try using the 'stack solver' command.

Help pls.

@ahmedriza
Copy link

@ayelich See the 2nd post above from @ariskou. You'll also need to apply the change mentioned by @BlackCapCoder to the following file in ghc-mod

core/GhcMod/Target.hs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet