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

Update README to list 9.6 properly #2665

Merged
merged 2 commits into from
Feb 14, 2024
Merged

Update README to list 9.6 properly #2665

merged 2 commits into from
Feb 14, 2024

Conversation

martijnbastiaan
Copy link
Member

Plus, test on 9.6 on Windows/macOS CI

Still TODO:

  • Write a changelog entry (see changelog/README.md)
  • Check copyright notices are up to date in edited files

@martijnbastiaan
Copy link
Member Author

martijnbastiaan commented Feb 11, 2024

@DigitalBrains1 Does it make sense to backport this? (Please remove label if you don't agree.)

@martijnbastiaan
Copy link
Member Author

clash-cores    > build (lib)
clash-cores    > Preprocessing library for clash-cores-1.9.0..
clash-cores    > Building library for clash-cores-1.9.0..
clash-cores    > copy/register
clash-cores    > Installing library in /home/martijn/code/clash-compiler/.stack-work/install/x86_64-linux/9fc55fd213bf1b00ee7d515b087bcc74dbd56f765dd603b686bed78ef4aa535e/9.6.4/lib/x86_64-linux-ghc-9.6.4/clash-cores-1.9.0-CP0mYy2dyK4IziztwaWrhf
clash-cores    > Error: Cabal-simple_6HauvNHV_3.10.1.0_ghc-9.6.4:
clash-cores    > '/home/martijn/.ghcup/ghc/9.6.4/bin/ghc' exited with an error:
clash-cores    > <command line>: Could not find module ‘GHC.TypeLits.Extra.Solver’
clash-cores    > Use -v (or `:set -v` in ghci) to see a list of the files searched for.
clash-cores    > 
Progress 1/2

Error: [S-7282]
       Stack failed to execute the build plan.
       
       While executing the build plan, Stack encountered the error:
       
       [S-7011]
       While building package clash-cores-1.9.0 (scroll up to its section to see the error) using:
       /home/martijn/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_6HauvNHV_3.10.1.0_ghc-9.6.4 --verbose=1 --builddir=.stack-work/dist/x86_64-linux/ghc-9.6.4 register
       Process exited with code: ExitFailure 1 

🤷

@DigitalBrains1
Copy link
Member

It makes sense to backport because it adds CI stuff.

The weird error is reproducable under Linux (that's a good thing). I can't get it to work. Applying the Nix workaround here:

    -- It's absolutely grimy, but if we don't specify the `-package` flags here
    -- then when nix eventually calls `./Setup register` on the package it will
    -- still pass the `-fplugin` options to GHC and fail to create the package
    -- registation file needed to finish the `installPhase`.
    --
    -- These flags are something we NEVER want to manually specify in a normal
    -- build, since correctly configuring this kind of thing should be solely
    -- left to cabal as a build tool.
    ghc-options:
      -package ghc-typelits-extra
      -fplugin GHC.TypeLits.Extra.Solver
      -package ghc-typelits-knownnat
      -fplugin GHC.TypeLits.Normalise
      -package ghc-typelits-natnormalise
      -fplugin GHC.TypeLits.KnownNat.Solver

does not help (it'll just say cannot satisfy -package ghc-typelits-extra instead). Adding -v to the GHC invocation lists it though:

clash-cores    > *** initializing unit database:
clash-cores    > package flags [-package-id QuickCheck-2.14.3-51OWnOyIZZW6KHd0V3EO9x{unit QuickCheck-2.14.3-51OWnOyIZZW6KHd0V3EO9x True ([])},
[...]
clash-cores    >                -package-id ghc-typelits-extra-0.4.6-L6c8cgcuJuRHcCyvlVGpAw{unit ghc-typelits-extra-0.4.6-L6c8cgcuJuRHcCyvlVGpAw True ([])},
clash-cores    >                -package-id ghc-typelits-knownnat-0.7.10-fJlMrMNkyh9qGWAkYZ6O6{unit ghc-typelits-knownnat-0.7.10-fJlMrMNkyh9qGWAkYZ6O6 True ([])},
clash-cores    >                -package-id ghc-typelits-natnormalise-0.7.9-2LocrQy3VVV7lBggmw970k{unit ghc-typelits-natnormalise-0.7.9-2LocrQy3VVV7lBggmw970k True ([])},

I don't know what's up. And if the flags are even meant to be passed; I think it is running Setup.hs? The comments seem to imply this is a mistake Nix makes, but not Cabal. And Stack (2.13.1) up to GHC 9.4 works fine, but goes bad with 9.6.

@christiaanb
Copy link
Member

christiaanb commented Feb 12, 2024

Fixed by haskell/cabal#9384, which is backported to Cabal-3.10, https://github.com/haskell/cabal/blame/3.10/Cabal/src/Distribution/Simple/GHC.hs#L1864, so could in principle be included in a GHC 9.6.5 release.

@christiaanb
Copy link
Member

As a work-around we can:

  1. add the latest 3.10 branch of cabal to the extra-deps in our stack.yaml:
 - git: https://github.com/haskell/cabal.git
   commit: a3865991986361b3a736007f620b6a8878d178e3
   subdirs:
   - Cabal
  1. Change the build-type of clash-cores.cabal file to Custom
  2. Add a custom-setup stanza to clash-cores.cabal containing:
custom-setup
  setup-depends:
    base,
    Cabal >= 3.10.2.1

Very ugly, but it works.

I have requested that GHC 9.8.2 comes with a version of Cabal containing the fix: https://gitlab.haskell.org/ghc/ghc/-/issues/24079#note_547902

@christiaanb
Copy link
Member

The same work-around could be applied to our starter projects in order to get them to work with GHC 9.6

@martijnbastiaan
Copy link
Member Author

martijnbastiaan commented Feb 12, 2024

First, nice digging. Second, what a mess :(. I'll apply the three steps of the workaround.

Edit: If we apply the version constraint, older GHCs fail to build. Cabal syntax refuses if impl there. Luckily, the version constraint is already implied by the extra-deps, so we don't need it.

@martijnbastiaan
Copy link
Member Author

I have requested that GHC 9.8.2 comes with a version of Cabal containing the fix: https://gitlab.haskell.org/ghc/ghc/-/issues/24079#note_547902

Okay, seems that we need to ask the Cabal maintainers to make a release in order for GHC to pick it up.

@martijnbastiaan
Copy link
Member Author

I've asked on the Haskell Matrix.

@martijnbastiaan
Copy link
Member Author

Screenshot from 2024-02-12 21-45-31

Paths differ slightly across different GHC versions and Custom/Simple
project setups.
Plus, test on 9.6 on Windows/macOS CI
@martijnbastiaan martijnbastiaan merged commit cb331a8 into master Feb 14, 2024
12 checks passed
@martijnbastiaan martijnbastiaan deleted the test-newer-ghcs branch February 14, 2024 12:54
mergify bot pushed a commit that referenced this pull request Feb 14, 2024
Plus, test on 9.6 on Windows/macOS CI

(cherry picked from commit cb331a8)

# Conflicts:
#	.github/workflows/ci.yml
#	README.md
martijnbastiaan added a commit that referenced this pull request Feb 27, 2024
Plus, test on 9.6 on Windows/macOS CI
martijnbastiaan added a commit that referenced this pull request Feb 27, 2024
Plus, test on 9.6 on Windows/macOS CI

Co-authored-by: Martijn Bastiaan <[email protected]>
pieter-bos added a commit to clash-lang/clash-cores that referenced this pull request Oct 8, 2024
This is the earliest release that includes the fix mentioned in clash-lang/clash-compiler#2665 (comment)
kleinreact pushed a commit to clash-lang/clash-cores that referenced this pull request Dec 5, 2024
This is the earliest release that includes the fix mentioned in clash-lang/clash-compiler#2665 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants