Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Cannot install GHC 9.4.3 on windows #129

Closed
robinheghan opened this issue Nov 27, 2022 · 30 comments · Fixed by #148
Closed

Cannot install GHC 9.4.3 on windows #129

robinheghan opened this issue Nov 27, 2022 · 30 comments · Fixed by #148
Assignees
Labels
platform: windows re: choco Concerning installation via chocolatey (windows)
Milestone

Comments

@robinheghan
Copy link

robinheghan commented Nov 27, 2022

Installing GHC 9.4.3 on Windows fails. 9.4.2 works fine.

Here is the error message:

Run haskell/actions/setup@v2
[6](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:7)
Preparing to setup a Haskell environment
[7](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:8)
Preparing ghc environment
[8](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:10)
Installing ghc version 9.4.3
[9](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:11)
  Attempting to install ghc 9.4.3 using chocolatey
[10](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:12)
  ::stop-commands::***
[11](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:13)
  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe choco install ghc --version 9.4.3 -m --no-progress -r
[12](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:14)
  Installing the same package with multiple versions is deprecated and will be removed in v2.0.0.
[13](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:15)
  Installing the following packages:
[14](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:16)
  ghc
[15](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:17)
  By installing, you accept licenses for the packages.
[16](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:18)
  
[17](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:19)
  ghc v9.4.3 [Approved]
[18](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:20)
  ghc package files install completed. Performing other installation steps.
[19](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:21)
  ERROR: Cannot bind argument to parameter 'Path' because it is null.
[20](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:22)
  Environment Vars (like PATH) have changed. Close/reopen your shell to
[21](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:23)
   see the changes (or in powershell/cmd.exe just type `refreshenv`).
[22](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:24)
  The install of ghc was NOT successful.
[23](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:25)
  Error while running 'C:\ProgramData\chocolatey\lib\ghc.9.4.3\tools\chocolateyInstall.ps1'.
[24](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:26)
   See log for details.
[25](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:27)
  
[26](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:28)
  Chocolatey installed 0/1 packages. 1 packages failed.
[27](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:29)
   See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
[28](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:30)
  
[29](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:31)
  Failures
[30](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:32)
   - ghc (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\ghc.9.4.3\tools\chocolateyInstall.ps1'.
[31](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:33)
   See log for details.
[32](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:34)
  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe choco install ghc --version 9.4.3 -m --no-progress -r --pre
[33](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:35)
  Installing the same package with multiple versions is deprecated and will be removed in v2.0.0.
[34](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:36)
  Installing the following packages:
[35](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:37)
  ghc
[36](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:38)
  By installing, you accept licenses for the packages.
[37](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:39)
  
[38](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:40)
  ghc v9.4.3 [Approved]
[39](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:41)
  ghc package files install completed. Performing other installation steps.
[40](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:42)
  ERROR: Cannot bind argument to parameter 'Path' because it is null.
[41](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:43)
  The install of ghc was NOT successful.
[42](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:44)
  Error while running 'C:\ProgramData\chocolatey\lib\ghc.9.4.3\tools\chocolateyInstall.ps1'.
[43](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:45)
   See log for details.
[44](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:46)
  
[45](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:47)
  Chocolatey installed 0/1 packages. 1 packages failed.
[46](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:48)
   See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
[47](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:49)
  
[48](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:50)
  Failures
[49](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:51)
   - ghc (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\ghc.9.4.3\tools\chocolateyInstall.ps1'.
[50](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:52)
   See log for details.
[51](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:53)
  ::***::
[52](https://github.com/gren-lang/compiler/actions/runs/3509357091/jobs/5878401466#step:4:55)
Error: All install methods for ghc 9.4.3 failed
@andreasabel
Copy link
Member

I get the same failure for 9.2.5. I reported this on the chocolatey repo: https://community.chocolatey.org/packages/ghc#comment-6045114046
I don't know where the root of the problem is. Installing 9.4.3 and 9.2.5 with ghcup succeeded on Windows for me.

@hazelweakly
Copy link
Collaborator

Sounds like it's more than past time for me to add in ghcup support for Windows then... 😅

@andreasabel
Copy link
Member

@Mistuke Maybe you have a clue what is going wrong here?

(NB. I previously commented via chocolatey disqus, but I prefer serious bug trackers. Is https://github.com/Mistuke/GhcChoco/issues a good place to do so?)

@andreasabel
Copy link
Member

@Mistuke: Has anything changed in the way chocolatey installs GHC from 9.4.2 to 9.4.3? I cannot really explain why this would suddenly break on this action's side...

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

Oh sorry, i missed this ticket. Hmm yes they had deprecated the method I was using to find the install dir so had to use the new install API. Let me take a look

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

@Mistuke Maybe you have a clue what is going wrong here?

(NB. I previously commented via chocolatey disqus, but I prefer serious bug trackers. Is https://github.com/Mistuke/GhcChoco/issues a good place to do so?)

Yes this is the best place, github comments get through my spam filter always.

@andreasabel so the package itself looks fine, I can install it no problem. The issue seems to be that haskell-actions is using an older version of chocolatey. With version 1.2 they deprecated using $env:chocolateyPackageFolder to find the install folder and instead require Get-ChocolateyPath. This function however is only available in version 1.2+. The old environment variables exist but the chocolatey community uploads won't allow uploads of new packages using them. This is why the install fails.

haskell/actions needs to update the chocolatey package in the image.

@andreasabel
Copy link
Member

andreasabel commented Dec 28, 2022

@Mistuke: Great, thanks for the analysis and the directions to solve this!

haskell/actions needs to update the chocolatey package in the image.

Er, I hate to say, but I am an absolute beginner here. Where would that be located?

@andreasabel andreasabel added the re: choco Concerning installation via chocolatey (windows) label Dec 28, 2022
@andreasabel
Copy link
Member

andreasabel commented Dec 28, 2022

Er, I hate to say, but I am an absolute beginner here. Where would that be located?

Do you mean the GHA virtual environments?

This should be fine then...

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

Indeed, but looks like that image was updates just last week https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md but this ticket is a bit older.

If it still doesn't work does anyone have a link to an actions log with more info?

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

In particular a run with -d as an option to chocolatey would be very helpful, it's hard for me to tell where in the script this comes from atm.

@andreasabel
Copy link
Member

andreasabel commented Dec 28, 2022

I am now adding this case (GHC 9.4.3 on Windows) to CI.
Started running: https://github.com/haskell/actions/actions/runs/3796497078/jobs/6456641107

Looks like it is still the same error:

ERROR: Cannot bind argument to parameter 'Path' because it is null.

@andreasabel
Copy link
Member

Here is a run with debug printing on: https://github.com/haskell/actions/actions/runs/3796535676/jobs/6456718151

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

awesome, thanks, that's very helpful, looks like the new API Get-ChocolateyPath is returning NULL.

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

ok, managed to reproduce it on my test env. working on a fix

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

The problem seems to be chocolatey's ill-intentioned approach to removing side-by-side installation support[1]. when using -m like actions does the new API returns NULL. Let me try to find a workaround. I complained chocolatey/choco#2878 (comment) about the plan, but if past actions is any indication they won't care, so I'll have to come with a workaround for this removal.

[1] chocolatey/choco#2878

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

Pushed:
Fixed 9.4.3 as 9.4.3.1 - https://community.chocolatey.org/packages/ghc/9.4.3.1
Added 9.4.4 - https://community.chocolatey.org/packages/ghc/9.4.4

They'll take a few hours to go through automated testing.

@andreasabel
Copy link
Member

@Mistuke: Phantastic!

I'll prepare the necessary meta-data additions on the action's side.

@andreasabel
Copy link
Member

@Mistuke: will you apply the same fix to GHC 9.2.5 (which had the same problem as 9.4.3)?

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

np, sorry for the breakage, I didn't test -m before pushing the new package. also didn't notice the message on the choco package page, as sometimes the msg'ed take a few hours to appear.

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

@Mistuke: will you apply the same fix to GHC 9.2.5 (which had the same problem as 9.4.3)?

oh, you're right, 9.2.5 uses the new API too. sure let me backport the fix,

@andreasabel
Copy link
Member

also didn't notice the message on the choco package page,

I now know a better place to message you about the choco GHC, as I am not friends with disqus anyway...

@andreasabel andreasabel self-assigned this Dec 28, 2022
@andreasabel andreasabel added this to the 2.0.5 milestone Dec 28, 2022
@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

Fixed 9.2.5 pushed as 9.2.5.1 - https://community.chocolatey.org/packages/ghc/9.2.5.1

@andreasabel
Copy link
Member

I'll try the new releases tomorrow (should be ready then).

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 28, 2022

Cheers, gonna go to bed, let me know how it goes, I tested locally in the sandbox with and without -m so should work.

@andreasabel
Copy link
Member

Good morning! So, 9.4.4 works now, 9.4.3 (and 9.2.5) not yet. The problem is on the action's side. I added some more debug printing to analyse it. In both cases, the chocolatey install of ghc is successful, but then the action succeeds for 9.4.4 and fails for 9.4.3.1:

9.4.4

https://github.com/haskell/actions/actions/runs/3799008955/jobs/6461524617#step:3:464

  ##[debug]getChocoPath(): chocoToolPath = C:\tools\ghc-9.4.4
  ##[debug]Search path 'C:\tools\ghc-9.4.4'
  ##[debug]getChocoPath(): found ghc at C:\tools\ghc-9.4.4\bin\ghc.exe

9.4.3.1

https://github.com/haskell/actions/actions/runs/3799008955/jobs/6461524713#step:3:468

  ##[debug]getChocoPath(): chocoToolPath = C:\ProgramData\chocolatey\lib\ghc.9.4.3.1
  ##[debug]Search path 'C:\ProgramData\chocolatey\lib\ghc.9.4.3.1'
  ##[debug]getChocoPath(): cannot find binary for ghc

The difference is caused by the action searching to C:\tools\ghc-9.4.3.1 which does not exist because installation happens into C:\tools\ghc-9.4.3: https://github.com/haskell/actions/actions/runs/3799008955/jobs/6461524713#step:3:433

Renamed C:\tools\ghc-9.4.3-x86_64-unknown-mingw32 to C:\tools\ghc-9.4.3
Running Install-ChocolateyPath -pathToInstall 'C:\tools\ghc-9.4.3\bin' 

This suggest the following solution: When resolving 9.4.3 -> 9.4.3.1, also remember the original version 9.4.3, to be used in the path C:\tools\ghc-9.4.3.

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 29, 2022

Morning, Hmm this has always been the case though, the X.Y.Z.n packages have always been metadata only releases. So there must be an existing mechanism somewhere to handle this already no?

@andreasabel
Copy link
Member

Morning, Hmm this has always been the case though, the X.Y.Z.n packages have always been metadata only releases. So there must be an existing mechanism somewhere to handle this already no?

If I understand correctly, the install location has changed for choco GHC >= 9, so this would explain why it does work for GHC < 9 but breaks here:

async function getChocoPath(tool: Tool, version: string): Promise<string> {
// Environment variable 'ChocolateyToolsLocation' will be added to Hosted images soon
// fallback to C:\\tools for now until variable is available
const chocoToolsLocation =
process.env.ChocolateyToolsLocation ??
join(`${process.env.SystemDrive}`, 'tools');
// choco packages GHC 9.x are installed on different path (C:\\tools\ghc-9.0.1)
let chocoToolPath = join(chocoToolsLocation, `${tool}-${version}`);
// choco packages GHC < 9.x
if (!fs.existsSync(chocoToolPath)) {
chocoToolPath = join(
`${process.env.ChocolateyInstall}`,
'lib',
`${tool}.${version}`
);
}

Btw, @maxim-lobanov , you wrote here on 2021-03-08:

// Environment variable 'ChocolateyToolsLocation' will be added to Hosted images soon

As of today, process.env.ChocolateyToolsLocation is still undefined (21 months later). Will this env variable become available or shall we remove the reference to it?
https://docs.chocolatey.org/en-us/create/functions/get-toolslocation says this env variable will be set by the Get-ToolsLocation choco command (but if I understand your comment correctly, it will be provided by the GHC virtual environments).

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 29, 2022

When you install chocolatey, it registers the following environment variables system wide:

ChocolateyInstall=C:\ProgramData\chocolatey
ChocolateyLastPathUpdate=133064413645727080
ChocolateyToolsLocation=C:\tools

So they should be there unless something is clobbering them..

@andreasabel
Copy link
Member

Yay, CI green! Many thanks @Mistuke for your excellent work!

I am intending to release this as 2.1.0, since medium code changes were involved.

@Mistuke
Copy link
Collaborator

Mistuke commented Dec 29, 2022

@andreasabel yay awesome! Thanks for reporting the failures!

andreasabel added a commit that referenced this issue Dec 29, 2022
This adds GHC versions 9.4.4 and 9.4.3 and 9.2.5 (the latter two were blocked by failure on Windows, #129).

Fixes #129:
- separate out choco revision mechanism (e.g. `9.4.3 -> 9.4.3.1`) from `resolved()` into new `releaseRevision()`
- this enables to find `ghc.exe`  correctly under `C:\tools\9.4.3` rather than the attempted `C:\tools\9.4.3.1`

Further:
- secure the problematic versions (7.10.3, 9.2.5, 9.4.3) by CI
- verbose chocolatey output in debug mode
9999years pushed a commit to 9999years/haskell-actions that referenced this issue Mar 27, 2024
This adds GHC versions 9.4.4 and 9.4.3 and 9.2.5 (the latter two were blocked by failure on Windows, haskell#129).

Fixes haskell#129:
- separate out choco revision mechanism (e.g. `9.4.3 -> 9.4.3.1`) from `resolved()` into new `releaseRevision()`
- this enables to find `ghc.exe`  correctly under `C:\tools\9.4.3` rather than the attempted `C:\tools\9.4.3.1`

Further:
- secure the problematic versions (7.10.3, 9.2.5, 9.4.3) by CI
- verbose chocolatey output in debug mode
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: windows re: choco Concerning installation via chocolatey (windows)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants