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

Add support for GHC-9.2.3 #2985

Closed
mouse07410 opened this issue Jun 23, 2022 · 41 comments
Closed

Add support for GHC-9.2.3 #2985

mouse07410 opened this issue Jun 23, 2022 · 41 comments
Labels
GHC issues with particular GHC versions type: enhancement New feature or request

Comments

@mouse07410
Copy link

mouse07410 commented Jun 23, 2022

Is your feature request related to a problem? Please describe.

In the GHC 9.2 realm, GHC-9.2.3 was released, among other reasons to fix bugs introduced in 9.2.2. It is currently very inconvenient to use 9.2.3 with an IDE, because with HLS services unavailable - IDE becomes little more than a dumb editor. This forces users to either abandon 9.2.+ features, or lose the help of HLS. Neither alternative is nice.

Describe the solution you'd like

There already is partial support in HLS for 9.2.2. I'd like to see at least partial support for 9.2.3 released ASAP. If the choice is between improving support for 9.2.2 and enabling 9.2.3 - IMHO, 9.2.3 wins hands down.

In other words: please prioritize adding partial support for 9.2.3 over improving generic 9.2 handling.

Describe alternatives you've considered

The are two alternatives: use 9.2.3 without HLS support, or use HLS with 9.0.2 (9.2.2 is not a preferred choice).

@michaelpj
Copy link
Collaborator

9.2.3 support is merged, and no compilation changes were required, so you can probably just compile HLS for 9.2.3 yourself, e.g. using ghcup.

It's unlikely that we will do a release with new binaries soon, however.

@mouse07410
Copy link
Author

mouse07410 commented Jun 23, 2022

and no compilation changes were required, so you can probably just compile HLS for 9.2.3 yourself, e.g. using ghcup.

Kindly explain how I can compile/install HLS using ghcup. I'd rather not build it myself directly from the source (aka, clone the repo myself and build with Cabal or such). What input do I provide to ghcup to get it to compile and install your master (or whatever tag that supports 9.2.3)? The page you referred to, says

You can also install HLS from source without checking out the code manually:

ghcup compile hls -v 1.6.1.0 --ghc 8.10.7

I know what GHC versions I want to compile it for - but what -v ... do I give???

Here's what ghcup tells me about available versions:

$ ghcup list
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
   Tool  Version  Tags                      Notes      
✗  ghc   7.10.3   base-4.8.2.0                         
✗  ghc   8.0.2    base-4.9.1.0    
.  .  .  .  .
✗  ghc   8.10.6   base-4.14.3.0                        
✓  ghc   8.10.7   recommended,base-4.14.3.0 hls-powered
✗  ghc   9.0.1    base-4.15.0.0                        
✓  ghc   9.0.2    base-4.15.1.0             hls-powered
✗  ghc   9.2.1    base-4.16.0.0             hls-powered
✗  ghc   9.2.2    base-4.16.1.0             hls-powered
✔✔ ghc   9.2.3    latest,base-4.16.2.0                 
✗  cabal 2.4.1.0                                       
.  .  .  .  .                                   
✗  cabal 3.6.0.0                                       
✔✔ cabal 3.6.2.0  latest,recommended                   
✗  hls   1.1.0 
.  .  .  .  .                                                                 
✗  hls   1.6.0.0                                       
✗  hls   1.6.1.0                                       
✔✔ hls   1.7.0.0  latest,recommended
✗  stack 2.5.1                   
.  .  .  .  .                                      
✗  stack 2.7.3                                         
✔✔ stack 2.7.5    latest,recommended                   
✔✔ ghcup 0.1.17.8 latest,recommended 

It's unlikely that we will do a release with new binaries soon, however.

Please reconsider.

Among multiple reasons for doing so, many people manage their Haskell platform installations via ghcup and indirectly via IDE like VS Code (which, in turn, uses ghcup).

Update

Attempting to use --git-ref to specify specific commit, failed:

$ ghcup compile hls -g 3461823 --ghc 8.8.4 --ghc 8.10.7 --ghc 9.0.2 --ghc 9.2.3
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref 3461823 (this may take a while)
[ git ] fatal: couldn't find remote ref 3461823

[ Error ] Download failed: Process "git" with arguments ["--no-pager",
[ ...   ]                                                "fetch", "--depth", "1", "--quiet", "origin",
[ ...   ]                                                "3461823"] failed with exit code 128.

@michaelpj
Copy link
Collaborator

cc @hasufell , maybe we can document this in ghcup more clearly?

@hasufell
Copy link
Member

ghcup compile hls -g master --ghc 9.2.3

@mouse07410
Copy link
Author

mouse07410 commented Jun 23, 2022

Thank you! Command provided by @hasufell seems to work, though I observe some strange errors:

$ ghcup compile hls -g master --ghc 8.8.4 --ghc 8.10.7 --ghc 9.0.2 --ghc 9.2.3
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref master (this may take a while)
xattr: [Errno 13] Permission denied: '/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101/.git/objects/pack/pack-6631889e9eeea5792885232d70f796b2a819cce0.idx'
xattr: [Errno 13] Permission denied: '/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101/.git/objects/pack/pack-6631889e9eeea5792885232d70f796b2a819cce0.pack'
[ Warn  ] Process "xattr" with arguments ["-r", "-d", "com.apple.quarantine",
[ ...   ]                                 "/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101"] failed with exit code 1.
[ Info  ] Git version master corresponds to HLS version 1.7.0.0
[ Info  ] Building HLS 1.7.0.0 for GHC version 8.8.4
.  .  .  .  .

One issue seems to be the com.apple.quarantine extended attribute that for some reason MacOS applied to the retrieved files. I never observe this when I manually (or from shell scripts) invoke git.

Perhaps, this could shed some light? It appears that the offending attribute is not set/present there?

$ ll -@ /private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101
total 672
drwx------   53 ur20980  staff    1696 Jun 23 12:47 ./
drwx------@ 280 ur20980  staff    8960 Jun 23 12:54 ../
	com.apple.rootless	     7 
drwxr-xr-x    3 ur20980  staff      96 Jun 23 12:47 .circleci/
-rw-r--r--    1 ur20980  staff     290 Jun 23 12:47 .editorconfig
drwxr-xr-x   13 ur20980  staff     416 Jun 23 12:47 .git/
drwxr-xr-x    7 ur20980  staff     224 Jun 23 12:47 .github/
-rw-r--r--    1 ur20980  staff     599 Jun 23 12:47 .gitignore
drwxr-xr-x    7 ur20980  staff     224 Jun 23 12:47 .gitlab/
-rw-r--r--    1 ur20980  staff   13109 Jun 23 12:47 .gitlab-ci.yml
-rw-r--r--    1 ur20980  staff     453 Jun 23 12:47 .gitmodules
-rw-r--r--    1 ur20980  staff    2445 Jun 23 12:47 .gitpod.yml
.  .  .  .  .

Second concern is this statement in the output:

[ Info  ] Git version master corresponds to HLS version 1.7.0.0

Is it trying to actually build the master, or v1.7.0.0?

Lastly, perhaps @hasufell could tell how I could instruct ghcup to compile a specific commit or tag?

@mouse07410
Copy link
Author

Update: no joy

Building master failed miserably.

On one machine (both are Macs, run the same version of MacOS 12.4, and have the same Haskell stuff installed (Cabal, Stack, GHC, ghcup, etc.)):

$ ghcup compile hls -g master --ghc 8.8.4 --ghc 8.10.7 --ghc 9.0.2 --ghc 9.2.3
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref master (this may take a while)
xattr: [Errno 13] Permission denied: '/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101/.git/objects/pack/pack-6631889e9eeea5792885232d70f796b2a819cce0.idx'
xattr: [Errno 13] Permission denied: '/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101/.git/objects/pack/pack-6631889e9eeea5792885232d70f796b2a819cce0.pack'
[ Warn  ] Process "xattr" with arguments ["-r", "-d", "com.apple.quarantine",
[ ...   ]                                 "/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101"] failed with exit code 1.
[ Info  ] Git version master corresponds to HLS version 1.7.0.0
[ Info  ] Building HLS 1.7.0.0 for GHC version 8.8.4
[ Info  ] Building HLS 1.7.0.0 for GHC version 8.10.7
[ cabal ] Haddock      ghc-lib-9.2.3.20220527 (lib)
[ cabal ] Warning: Failed to build documentation for ghc-lib-9.2.3.20220527 (which is
[ cabal ] required by exe:haskell-language-server from haskell-language-server-1.7.0.0).
[ cabal ] Copying 'haskell-language-server' to
[ cabal ] '/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101/out/8.10....
[ cabal ] /Users/ur20980/.cabal/store/ghc-8.10.7/hskll-lngg-srvr-1.7.0.0-21a26a5f/bin/haskell-langua...
[ Error ] BuildFailed failed in dir /private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101: Process "cabal" with arguments ["v2-install",
[ ...   ]                                                                                                                                            "-w",
[ ...   ]                                                                                                                                            "ghc-8.10.7",
[ ...   ]                                                                                                                                            "--install-method=copy",
[ ...   ]                                                                                                                                            "--overwrite-policy=always",
[ ...   ]                                                                                                                                            "--disable-profiling",
[ ...   ]                                                                                                                                            "--disable-tests",
[ ...   ]                                                                                                                                            "--installdir=/private/var/folders/_l/4q83bg9j5ysb7qd1n9xpnb4h0000gn/T/ghcup-6034511dda1ef101/out/8.10.7",
[ ...   ]                                                                                                                                            "--project-file=cabal.project",
[ ...   ]                                                                                                                                            "exe:haskell-language-server",
[ ...   ]                                                                                                                                            "exe:haskell-language-server-wrapper"] failed with exit code 1.
$ 

Another machine (very similar output):

$ time ghcup compile hls -g master -j 20 --ghc 9.2.3 --ghc 9.0.2 --ghc 8.10.7 --ghc 8.8.4 --ghc 8.6.5
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref master (this may take a while)
xattr: [Errno 13] Permission denied: '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-04fef3c08beca58e/.git/objects/pack/pack-25c0ac79253f478d02acdf7de257126580cfb2c6.pack'
xattr: [Errno 13] Permission denied: '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-04fef3c08beca58e/.git/objects/pack/pack-25c0ac79253f478d02acdf7de257126580cfb2c6.idx'
[ Warn  ] Process "xattr" with arguments ["-r", "-d", "com.apple.quarantine",
[ ...   ]                                 "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-04fef3c08beca58e"] failed with exit code 1.
[ Info  ] Git version master corresponds to HLS version 1.7.0.0
[ Info  ] Building HLS 1.7.0.0 for GHC version 8.6.5
[ Info  ] Building HLS 1.7.0.0 for GHC version 8.8.4
[ Info  ] Building HLS 1.7.0.0 for GHC version 8.10.7
[ cabal ] Haddock      ghc-lib-9.2.3.20220527 (lib)
[ cabal ] Warning: Failed to build documentation for ghc-lib-9.2.3.20220527 (which is
[ cabal ] required by exe:haskell-language-server from haskell-language-server-1.7.0.0).
[ cabal ] Copying 'haskell-language-server' to
[ cabal ] '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-04fef3c08beca58e/out/8.10.7/haskell-language-server'
[ cabal ] /Users/ur20980/.cabal/store/ghc-8.10.7/hskll-lngg-srvr-1.7.0.0-21a26a5f/bin/haskell-language-server: copyFile:atomic...
[ Error ] BuildFailed failed in dir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-04fef3c08beca58e: Process "cabal" with arguments ["v2-install",
[ ...   ]                                                                                                                                            "-w",
[ ...   ]                                                                                                                                            "ghc-8.10.7",
[ ...   ]                                                                                                                                            "--install-method=copy",
[ ...   ]                                                                                                                                            "--jobs=20",
[ ...   ]                                                                                                                                            "--overwrite-policy=always",
[ ...   ]                                                                                                                                            "--disable-profiling",
[ ...   ]                                                                                                                                            "--disable-tests",
[ ...   ]                                                                                                                                            "--installdir=/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-04fef3c08beca58e/out/8.10.7",
[ ...   ]                                                                                                                                            "--project-file=cabal.project",
[ ...   ]                                                                                                                                            "exe:haskell-language-server",
[ ...   ]                                                                                                                                            "exe:haskell-language-server-wrapper"] failed with exit code 1.

real	75m52.808s
user	266m42.053s
sys	52m0.201s
$ 

Which makes me repeat my request: please release HLS binary that supports GHC-9.2.3.

@hasufell
Copy link
Member

ghcup compile hls -g master --ghc 8.8.4 --ghc 8.10.7 --ghc 9.0.2 --ghc 9.2.3

You only need to build for the GHC you're missing. There's no point to build the others.

Lastly, perhaps @hasufell could tell how I could instruct ghcup to compile a specific commit or tag?

See ghcup compile hls --help:

ghcup compile hls -g <ref/tag/commit/branch> --ghc 9.2.3

For the build failure look into ~/.ghcup/logs.

@mouse07410
Copy link
Author

You only need to build for the GHC you're missing. There's no point to build the others

Understood, thanks!

ghcup compile hls -g <ref/tag/commit/branch> --ghc 9.2.3

My problem is - I don't understand what to actually put in place of <ref/tag/commit/branch>. For example, I want to build HLS for commit 3461823. What should the value of -g argument be in this case?

[ Info ] Git version master corresponds to HLS version 1.7.0.0

Can you confirm that it is trying to actually build the master, and not v1.7.0.0?

For the build failure look into ~/.ghcup/logs

$ cat ~/.ghcup/logs/git.log
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-ddcbed873b0cb2c5/.git/
Note: switching to 'FETCH_HEAD'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 3461823 hls-class-plugin enhancement (#2920)
$ cat ~/.ghcup/logs/ghcup.log 
Debug: Identified Platform as: Darwin
Debug: last access was 6703.842568s ago, cache interval is 300s
Info: downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml
Debug: Read etag: "016dfaa3cea382322198820cd4839eaf46ce230336fca2282e865ba00e570b35"
Debug: Status code was 304, not overwriting
Debug: Parsed etag: "016dfaa3cea382322198820cd4839eaf46ce230336fca2282e865ba00e570b35"
Debug: Writing etagsFile /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml.etags
Debug: Decoding yaml at: /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml
Info: Fetching git repo https://github.com/haskell/haskell-language-server.git at ref master (this may take a while)
Debug: Running git with arguments ["--no-pager","init"]
Debug: Running git with arguments ["--no-pager","remote","add","origin","https://github.com/haskell/haskell-language-server.git"]
Debug: Running git with arguments ["--no-pager","fetch","--depth","1","--quiet","origin","master"]
Debug: Running git with arguments ["--no-pager","checkout","FETCH_HEAD"]
Warn: Process "xattr" with arguments ["-r", "-d", "com.apple.quarantine",
                                "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-ddcbed873b0cb2c5"] failed with exit code 1.
Info: Git version master corresponds to HLS version 1.7.0.0
Info: Building HLS 1.7.0.0 for GHC version 8.6.5
Debug: Running cabal with arguments ["v2-install","-w","ghc-8.6.5","--install-method=copy","--jobs=20","--overwrite-policy=always","--disable-profiling","--disable-tests","--installdir=/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-ddcbed873b0cb2c5/out/8.6.5","--project-file=cabal.project","exe:haskell-language-server","exe:haskell-language-server-wrapper"]
Info: Building HLS 1.7.0.0 for GHC version 8.8.4
Debug: Running cabal with arguments ["v2-install","-w","ghc-8.8.4","--install-method=copy","--jobs=20","--overwrite-policy=always","--disable-profiling","--disable-tests","--installdir=/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-ddcbed873b0cb2c5/out/8.8.4","--project-file=cabal.project","exe:haskell-language-server","exe:haskell-language-server-wrapper"]

@mouse07410
Copy link
Author

@hasufell your suggestion to build only for 9.2.3 worked, thank you:

$ time ghcup compile hls -g master -j 20 --ghc 9.2.3
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /Users/ur20980/.ghcup/cache/ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref master (this may take a while)
xattr: [Errno 13] Permission denied: '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-1a6317f6b81ee9fe/.git/objects/pack/pack-6631889e9eeea5792885232d70f796b2a819cce0.idx'
xattr: [Errno 13] Permission denied: '/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-1a6317f6b81ee9fe/.git/objects/pack/pack-6631889e9eeea5792885232d70f796b2a819cce0.pack'
[ Warn  ] Process "xattr" with arguments ["-r", "-d", "com.apple.quarantine",
[ ...   ]                                 "/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ghcup-1a6317f6b81ee9fe"] failed with exit code 1.
[ Info  ] Git version master corresponds to HLS version 1.7.0.0
[ Info  ] Building HLS 1.7.0.0 for GHC version 9.2.3
[ Info  ] Installing HLS
[ Info  ] HLS successfully compiled and installed
[ Info  ] This is just the server part of your LSP configuration. Consult the README on how to
[ ...   ] configure HLS, your project and your LSP client in your editor:
[ ...   ]   https://github.com/haskell/haskell-language-server/blob/master/README.md
[ ...   ] 
1.7.0.0
real	16m5.940s
user	68m21.132s
sys	9m16.111s
$

@wraithm
Copy link

wraithm commented Jun 27, 2022

Just curious, why not release new binaries, @michaelpj? When would you roughly expect a new release?

I'd love to get my team fully switched over to GHC 9.2.3, but it can be a bit frustrating to get all of them to compile it. There are often subtleties with using ghcup to compile hls, I've found. Maybe that's all been fixed. It'd be a lot easier if there were a new release.

Thanks for all your hard work!

@hasufell
Copy link
Member

I'd love to get my team fully switched over to GHC 9.2.3, but it can be a bit frustrating to get all of them to compile it.

ghcup compile hls -j 10 -v 1.7.0.0 --ghc 9.2.3

@michaelpj
Copy link
Collaborator

Just curious, why not release new binaries, @michaelpj? When would you roughly expect a new release?

Doing a release is currently a fair amount of work, someone needs to step up to do it. We don't have a release schedule largely because we're low on people who are willing to do the release work.

@wraithm
Copy link

wraithm commented Jun 28, 2022

Thanks @michaelpj for the insight. We'd be happy to pitch in to help with the release work if you think that makes sense. HLS is an amazing project and totally critical for us. Is there a document or something you could point me to for me to understand what's involved?

btw, @hasufell, your suggestion did not work. I needed to point it at master to get it to compile. Then even if it compiles, there's no guarantee that it'll work. I might have to just compile from your repository without ghcup. I'll report back.

$ ghcup compile hls -j 14 -v 1.7.0.0 --ghc 9.2.3
[ Info  ] downloading: https://downloads.haskell.org/~hls/haskell-language-server-1.7.0.0/haskell-language-server-1.7.0.0-src.tar.gz as file /tmp/ghcup-d0cab68807a3b970/haskell-language-server-1.7.0.0-src.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5546k  100 5546k    0     0  3274k      0  0:00:01  0:00:01 --:--:-- 3273k
[ Info  ] verifying digest of: haskell-language-server-1.7.0.0-src.tar.gz
[ Info  ] Unpacking: haskell-language-server-1.7.0.0-src.tar.gz to /tmp/ghcup-6ac82875ea639f5c
[ Info  ] Building HLS 1.7.0.0 for GHC version 9.2.3
[ cabal ] base-3.0.3.1 (constraint from non-upgradeable package requires installed
[ cabal ] instance)
[ cabal ] [__2] fail (backjumping, conflict set: base, ghcide, hiedb)
[ cabal ] After searching the rest of the dependency tree exhaustively, these were the
[ cabal ] goals I've had most trouble fulfilling: base, ghcide, hiedb
[ cabal ] 
[ Error ] BuildFailed failed in dir /tmp/ghcup-6ac82875ea639f5c/haskell-language-server-1.7.0.0: Process "cabal" with arguments ["v2-install",
[ ...   ]                                                                                                                        "-w",
[ ...   ]                                                                                                                        "ghc-9.2.3",
[ ...   ]                                                                                                                        "--install-method=copy",
[ ...   ]                                                                                                                        "--jobs=14",
[ ...   ]                                                                                                                        "--overwrite-policy=always",
[ ...   ]                                                                                                                        "--disable-profiling",
[ ...   ]                                                                                                                        "--disable-tests",
[ ...   ]                                                                                                                        "--installdir=/tmp/ghcup-6ac82875ea639f5c/haskell-language-server-1.7.0.0/out/9.2.3",
[ ...   ]                                                                                                                        "--project-file=cabal.project",
[ ...   ]                                                                                                                        "exe:haskell-language-server",
[ ...   ]                                                                                                                        "exe:haskell-language-server-wrapper"] failed with exit code 1.

This is why I'm kind of hesitant to tell my company to compile it. It's actually kind of subtle to get it all to work right.

Thanks again for your help.

@hasufell
Copy link
Member

Then even if it compiles, there's no guarantee that it'll work.

I'm not sure I understand. It compiled from master and runs, but you're not sure "it works"?

@wraithm
Copy link

wraithm commented Jun 28, 2022

Then even if it compiles, there's no guarantee that it'll work.

I'm not sure I understand. It compiled from master and runs, but you're not sure "it works"?

It is possible for a thing to compile and not actually function as intended. This has happened to me with ghcup-compiled HLS in the past! I've compiled using ghcup, and then HLS just can't load anything properly. If I compiled out of a manually cloned repository, which I'm sure is slightly different than how ghcup is compiling it (probably different compiler flags, or a different compiler version, or something), then it often works straightforwardly.

It seems those issues have been resolved. I tested the ghcup-compiled with GHC 9.2.3 on master. It seems to work. Thanks for your help.

@wclr
Copy link

wclr commented Jul 3, 2022

After

> cabal update
> ghcup compile hls -g master --ghc 9.2.3

it works ok.

@mouse07410
Copy link
Author

It's simple. ghcup decides that HLS master is v1.7.0.0 based on the "Version:" field of the project .cabal file, while in fact (that field in) that file simply hasn't changed since the 1.7.0.0 release.

So, trying to build HLS 1.7.0.0 with GHC-9.2.3 is bound to fail. But building HLS with -g master will succeed, despite ghcup claiming that it's building 1.7.0.0.

@hasufell
Copy link
Member

hasufell commented Jul 3, 2022

ghcup decides that HLS master is v1.7.0.0 based on the "Version:" field of the project .cabal file, while in fact (that field in) that file simply hasn't changed since the 1.7.0.0 release.

Yes, because what else is it supposed to do? Come up with its own imaginary version?

But building HLS with -g master will succeed, despite ghcup claiming that it's building 1.7.0.0

Yes, because it is 1.7.0.0. There is only one place you can define a project version in Haskell: the cabal file.

If you take a look at ghcup compile hls --help, you will see that there is an --overwrite-version option... so you can do:

ghcup compile hls -g master --ghc 9.2.3 --overwrite-version 1.7.0.1

if you please so.

@mouse07410
Copy link
Author

mouse07410 commented Jul 3, 2022

what else is it supposed to do?

Well, I can't tell you what your programs should do, but, in my opinion, when ghcup is compiling from the source a specific commit or master branch or such - it should report exactly that: "building master", or "building commit #xxxx".

That IMHO would be better than either guessing the version (which doesn't exist yet - you can't know if the next release would be 1.7.1.0, or 1.8.0.0, or whatever), or falsely reporting a version that the code does not correspond to (to prove this fact, compare the results of building "-v 1.7.0.0" and "-g master", and explain why they differ, even though both are reported by ghcup as "1.7.0.0").

There is only one place you can define a project version in Haskell: the cabal file.

In theory - perhaps. In practice - I haven't seen any package whose Version field of cabal file actually tracked every commit and such. When the release is locked, this field is adjusted, and then usually left alone until the next release is ready. Which makes relying on this field for anything between-releases unreliable at best.

@hasufell
Copy link
Member

hasufell commented Jul 3, 2022

Well, I can't tell you what your programs should do, but, in my opinion, when ghcup is compiling from the source a specific commit or master branch or such - it should report exactly that: "building master", or "building commit #xxxx".

If you read the output, it does exactly that:

$ ghcup compile hls -j 14 -g master --ghc 9.2.3
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref master (this may take a while)
[ Info  ] Git version master corresponds to HLS version 1.7.0.0
[ Info  ] Building HLS 1.7.0.0 for GHC version 9.2.3

It even tells you twice:

What is unclear about this? Yes, we could additionally dereference master to the current commit it points to. But that won't solve the core issue.

That IMHO would be better than either guessing the version

This is not a solution.

We're extracting the version, because we need a version so that we can name the binaries correctly. Or do you want to have binaries named:

  • haskell-language-server-wrapper-d4eea6627cd679be97b795187b7f5115186775b7?

This would create an insane mess in ghcup list, ghcup tui and any other command. Haskell programs follow PVP. Commit hash is not valid PVP.

or falsely reporting a version that the code does not correspond to (to prove this fact, compare the results of building "-v 1.7.0.0" and "-g master", and explain why they differ, even though both are reported by ghcup as "1.7.0.0").

We're not falsely reporting anything. We're reporting whatever the maintainers have set the version as. Use the --overwrite-version option if you want to specify what the binaries should be named as.

You really haven't given an alternative approach here.

@mouse07410
Copy link
Author

Git version master corresponds to HLS version 1.7.0.0 . . .
What is unclear about this?

Maybe the above is clear to you. To me it's confusing, because "Git version master" at this point is neither 1.7.0.0, nor 1.x.x.x. But I'm afraid we'd have to agree to disagree here. We don't seem to understand each other's points.

We're extracting the version, because we need a version so that we can name the binaries correctly.

There are two issues - naming the binaries and reporting what actual version those binaries correspond to. I claim that you're probably right regarding the first part, but not - with the second...

Or do you want to have binaries named haskell-language-server-wrapper-d4eea66?

Strictly speaking, haskell-language-server-wrapper-d4eea66 is exactly what it is. But (I think) I see your point regarding how to name the actual files in ~/.ghcup/bin/, and how to deal with them.

In most of the packages I've dealt with, executables build from between-the-releases Git code respond to -V flag with something like xxxx-dirty-d4eea66. But the actual file would be named xxxx, not xxxx-dirty-d4eea66.

This would create an insane mess in ghcup list, ghcup tui and any other command.

I cannot argue with you here, as I don't have sufficient appreciation of what's involved.

Haskell programs follow PVP. Commit hash is not valid PVP.

Haskell released programs follow PVP, or at least should. My point is that there's no valid PVP for a between-the-releases code snapshot, and commit hash is the closest to its unique identification.

We're not falsely reporting anything. We're reporting whatever the maintainers have set the version as.

I tried to explain why what the maintainers have set does not apply in these cases.

Use the --overwrite-version option if you want to specify what the binaries should be named as.

Thanks. I did not think of this option. What are the consequences of using it, e.g., specifying --overwrite-version d4eea66?

You really haven't given an alternative approach here.

I wish I knew a simple all-satisfying all-encompassing alternative.

As I said, in other projects - those few that I (co-)maintain and those many that I use - usually binaries report their versions as ...dirty-<truncated_commit_hash>, while binary files themselves just bear their normal names, like botan, or asn1c, or .

In one case (asn1c), my code reports the previously-released version, even though the code moved away from it far enough. The main reason is - I couldn't figure how to make it report the current commit level within the time I could afford to spend on it. And users that requested that it reported "dirty" snapshots at the commit level, couldn't provide a PR that I would use. I guess we're in a similar situation here - I can't provide a PR for you that would accomplish the goal. :-(

@hasufell
Copy link
Member

hasufell commented Jul 4, 2022

What are the consequences of using it, e.g., specifying --overwrite-version d4eea66?

ghcup allows this (I think), but will treat it differently in certain circumstances, because it's not a valid PVP version.

@istathar
Copy link

istathar commented Jul 5, 2022

Doing a release is currently a fair amount of work, someone needs to step up to do it. We don't have a release schedule largely because we're low on people who are willing to do the release work.

Is this the sort of thing the Haskell foundation can help with? It seems like automating the production of release binaries would be a huge win. New GHC releases are frequent and not being able to use them means they're not getting the testing they deserve. It's not reasonable to expect volunteers to do drudge toil every time there's a new upstream version bump.

@hasufell
Copy link
Member

hasufell commented Jul 5, 2022

Is this the sort of thing the Haskell foundation can help with?

I guess they can pay someone, but then you either need the company of the employee to approve or engage people who are freelancers (I'm available until 27 july).

Although there's a full time devops now working on GitLab GHC CI, I'm not sure this would be within scope of that position. I'm also a bit worried it would lead to everything nixified, which would be bad for the bus factor.

Good releases can't be fully automated. You need to talk to people, clear some dust, do manual testing.

@hasufell
Copy link
Member

hasufell commented Jul 5, 2022

New GHC releases are frequent

Yes, maybe too frequent and they put a lot of work on packagers. I had to fix around 20 bindists (unpack, fix Makefile, repack, upload, update hashes and URLs in ghcup metadata), because of a GHC build system bug for the next ghcup release.

Luckily, many LSP installers, like vscode-haskell and nvim-lsp-installer use ghcup, so any work on HLS bindists at least isn't duplicated.

This is just my opinion, but I really think installing HLS from source should be a good option and be made as easy as possible. I can imagine adding a command in vscode-haskell to do that automatically in case the pre-packaged binaries are not sufficient.

@istathar
Copy link

istathar commented Jul 6, 2022

For some context, we have been working on getting our Haskell code upgraded to the latest GHC, or near enough. For those unfamiliar with Stack, the version of the Haskell compiler we get is specified in the "snapshot" we point to with the resolver field in the stack.yaml file. For the two current stable branches:

  • lts-18.28 → GHC 8.10.7 (what we're still using now)
  • lts-19.14 → GHC 9.0.x

The trouble is that GHC 9.0 was widely viewed as a dud; there are too many bugs and upstream has moved on already. Which is great! but there's not yet a "stable" snapshot with GHC 9.2, but it is what's on the "nightly" one.

  • nightly-2022-06-06 → GHC 9.2.2
  • nightly-2022-07-04 → GHC 9.2.3

Which would be great except that as we've been discussing haskell-language-server doesn't support GHC 9.2.3 yet (so be it; this is open source. We gratefully accept the generous contributions of all concerned).

I did some experimenting and tried something that's been there almost since the beginning of Stack but that I've never tried before: you can specify a different compiler. This is what I put in a given project's stack.yaml:

resolver: nightly-2022-07-04
compiler: ghc-9.2.2

Ordinarily you wouldn't do that because the whole point of a Stackage snapshot is that it's a set of packages that are known to build together—and the most fundamental of those packages are the ones from base & friends which are shipped with GHC, not downloaded separately from Hackage.

But I took a punt, on the presumption that in essence nothing in base et al would have changed irredeemably between 9.2.2 and 9.2.3. It worked; the HLS brought in by VSCode is doing its thing.

So this is a workaround. This really isn't a good idea in anything other than the short term, because as mentioned drift between what's been qualified in Stackage CI and the libraries supplied by the compiler will very shortly become irreconcilable. But this buys a little time for the people generously working on HLS to be able to get a release out that supports GHC 9.2.3.

@wraithm
Copy link

wraithm commented Jul 6, 2022

This is just my opinion, but I really think installing HLS from source should be a good option and be made as easy as possible.

This doesn't scale well. My team is only 12 engineers, and I spent a good deal of my time last week fixing everyone's problems related to upgrading HLS via compiling from source. I could not predict all of the issues. Trying to get 12 people to compile something, especially without an official release, is very painful. There's lots of weird issues on everyone's machines that you wouldn't expect. I tried to make it as absolutely clear as possible what to do, but it doesn't work out as you plan, especially for a project as complicated as HLS.

I agree it should be a good option to compile from source, but the reality is that it's quite complicated in practice.

I completely echo @istathar's points. We are in exactly the same situation and made a very similar decision.

We're willing to help here! I think it'd be amazing to try to get the Haskell Foundation involved.

@mouse07410
Copy link
Author

mouse07410 commented Jul 6, 2022

@wraithm I'm not sure I follow. I'll be the first to say that we need official release of the HLS that supports GHC-9.2.3, but I found no difficulty (after the process was explained here 😉) making ghcup compile HLS from the source. And my config isn't mainstream-ish, as everything is built/linked dynamically - AFAIK, few even cover this in their CI testing.

Basically, all I needed was to specify -g master flag. It did take about 30+ minutes to compile, but I don't see it as a big deal, since it's done rarely.

I did not want to use 9.2.2 (it has bugs, many of which 9.2.3 fixes), nor 9.0.x - for reasons brought up by others. At this point, HLS master works reasonably well with 9.2.3.

@istathar
Copy link

istathar commented Jul 6, 2022

@mouse07410

I'm not sure I follow.

The point is that we're all relying on the automation to download a toolchain (which includes editor support) for everyone on a team so that no one has to think about it. If we have to tell everyone to "stop what you're doing, manually build the language server, install it in the proper place [good luck with that], and configure your IDE to use it" it's a big ask times n people. And it's absolutely impossible for members of the team who are new to Haskell.

Now, that's not on the HLS contributors to resolve, but we've set a high bar across the Haskell ecosystem. The last couple of years have been amazing, with the VSCode Haskell extension downloading the prebuilt language server automatically; with Stack and GHCup bringing prebuilt compilers in automatically, with Stackage giving us sets of packages that actually build together ... it all Just Working™ and it's awesome.

Since this has become a critical part of the workflow of so many of us, we're asking how we can help (but also asking how we can make the problem go away). I'm funding getting Stack upgraded to fully support 9.2.x, hopefully others can step in to see HLS get the help in needs too. Please let us know what's needed.

@hasufell
Copy link
Member

hasufell commented Jul 6, 2022

@istathar

I did some experimenting and tried something that's been there almost since the beginning of Stack but that I've never tried before: you can specify a different compiler. This is what I put in a given project's stack.yaml:

Yes, I already explained this here haskellfoundation/tech-proposals#16 (comment)

My suggestion is to use cabal with stackage.

Ordinarily you wouldn't do that because the whole point of a Stackage snapshot is that it's a set of packages that are known to build together—and the most fundamental of those packages are the ones from base & friends which are shipped with GHC, not downloaded separately from Hackage.

Well, not really. PVP guarantees backwards compatibility and from what I know there are no major PVP bumps within a major GHC release.

E.g. GHC-8.10.1 ships with base-4.14.0.0 and GHC-8.10.7 ships with base-4.14.3.0. PVP demands that there must be no API breaking changes between those base versions.

The story might be a little different if you depend on the ghc API itself.


@wraithm

There's lots of weird issues on everyone's machines that you wouldn't expect.
I agree it should be a good option to compile from source, but the reality is that it's quite complicated in practice.

Well, we can't improve ghcup or HLS compilation if you don't submit bug reports about what went wrong while compiling HLS.


@istathar

If we have to tell everyone to "stop what you're doing, manually build the language server, install it in the proper place [good luck with that], and configure your IDE to use it" it's a big ask times n people.

Again: this is automated via: ghcup compile hls -g master -o 1.7.0.1 --ghc 9.2.3. If this doesn't work for you, open a bug report. The VSCode extension will automatically figure out what to do once its installed. The only point of failure really is ghcup compile hls. This also has the advantage that it fixes ABI mismatch issues that sometimes arise when using non-standard GHC installations/bindists.

Adding GHC-9.2.3 pre-built bindists is fine too. But I'd also like to improve the ad-hoc compilation so that we have less pressure on constantly working on bindists, CI etc.

@mouse07410
Copy link
Author

If we have to tell everyone to "stop what you're doing, manually build the language server, install it in the proper place [good luck with that], and configure your IDE to use it" it's a big ask times n people.

@istathar sorry, the above is absolutely not what I'm observing:

  1. "manually build..." - currently ghcup compile hls -g master --ghc 9.2.3 is all it takes. Yes, it's worse than ghcup install hls - but you'd probably agree it's not much more difficult.
  2. "install it in the proper place [good luck with that]" - the above command gives me "good luck" 100% of the time, installing the compiled HLS binary in the proper place every time.
  3. "configure your IDE to use it" - I haven't touched my IDE (VSCode) config, and it was not needed. My vscode-haskell is configured to use ghcup to manage Haskell installation.
  4. "t's a big ask times n people" - based on my experience, there's nothing big in this task, though indeed n people would have to perform one command (see above).

@wraithm
Copy link

wraithm commented Jul 6, 2022

@hasufell, the issues we ran into are not bugs. It's just people having weird cabal setups on their machines, or forgetting to do cabal update, etc. I guarantee you if I posted all of the issues, you'd close the issues immediately. It's just simply a headache trying to get >10 people with heterogeneous setups (OS, editor, etc) to all do a kinda tricky thing without running into problems, not bugs just stumbling.

As I said, I tried to give clear instructions with a script, but it's not that simple. Also, it took me a while to figure out exactly what the right command was to get this to work. For example, I didn't even have them do -o 1.7.0.1. You just added that here in this discussion at the last second after we've already done all the upgrades and effort. It was tricky to figure out what to do, and it was difficult to implement. Just lots of friction.

We're offering to help! I don't understand why there's something wrong with offers of help to do releases. If we had binary releases, I would have several hours back of my and many others' time.

@hasufell
Copy link
Member

hasufell commented Jul 6, 2022

I guarantee you if I posted all of the issues, you'd close the issues immediately

I certainly won't. But I sense that you're not interested to report user experiences. That makes my life difficult.

E.g. I just created a PR to improve various things in ghcup compile hls: https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/267

Also, it took me a while to figure out exactly what the right command was to get this to work

Yes, we're trying to improve the documentation on this as well: #3004

We're offering to help! I don't understand why there's something wrong with offers of help to do releases.

I think we made clear that we do accept help with releases and are planning to do an update. But it's not the only direction that needs work to make things better.

@Bodigrim
Copy link
Contributor

Bodigrim commented Jul 9, 2022

I have a good experience with compiling HLS directly from Hackage:

cabal install haskell-language-server --constraint 'haskell-language-server -haddockComments' -w ghc-9.2.3

From my perspective it is easier than search for bindists, and recompilation does not take long, because it leverages all normal Cabal caching mechanisms. Compilation from the repo (as ghcup does) is a bit slower, since all vendored packages (ghcide, plugins, etc.) are unconditionally recompiled and likely against an old index-state, so almost everything is rebuilt.

@hasufell
Copy link
Member

hasufell commented Jul 9, 2022

Compilation from the repo (as ghcup does) is a bit slower, since all vendored packages (ghcide, plugins, etc.) are unconditionally recompiled and likely against an old index-state, so almost everything is rebuilt.

I'm not sure I follow. We use cabal v2-install, which caches all "vendored" (you probably mean local) packages (ghcide, plugins, etc.). cabal v2-install does an sdist of all local packages, unpacks them to a tmp dir and builds them there. This leads to everything being cached. So running ghcup compile hls -g 0f6cd41d51e1dd81ddeb117ab949ceb1f38e68cf --ghc 8.10.7 twice does not cause re-compilation. The second run is almost instant.

In addition, pinned index state reduces recompilation, it doesn't increase it.

If you want to ignore the index state from the cabal.project, you simply do:

ghcup compile hls -v 1.7.0.0 --ghc 8.10.7 -- --index-state=@(date '+%s')

@mouse07410
Copy link
Author

mouse07410 commented Jul 9, 2022

I don't understand @Bodigrim point. The main reason to compile HLS from source IMHO is to get patches that haven't made it to Hackage (yet).

I assume that pushing sources to Hackage coincides with a new binary release?

@Bodigrim
Copy link
Contributor

Bodigrim commented Jul 9, 2022

@mouse07410 there is no binary release of HLS for GHC 9.2.3, but you can grab already released packages for HLS 1.7 from Hackage and compile them yourself. You don't even need ghcup, if for some reason you do not use it, any ordinary cabal or stack will do.

@hasufell
Copy link
Member

hasufell commented Jul 9, 2022

True... users have these options:

  1. build from hackage via cabal or stack
  2. build from the source repo via cabal or stack
  3. use the bindists from https://downloads.haskell.org/~hls/haskell-language-server-1.7.0.0/ manually
  4. use ghcup to install bindists
  5. use ghcup to compile from source dists or repository

I mean, we could certainly add more documentation about all those. But is it really that difficult?

@hasufell
Copy link
Member

hasufell commented Jul 9, 2022

Thinking about @Bodigrim's comment, there's one main advantage of hackage dist: in-place updates of version bounds. I remember getting odd errors with ghcup compile hls -v 1.7.0.0, because the bounds were outdated.

PR to add support for building from hackage: https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/268

@mouse07410
Copy link
Author

mouse07410 commented Jul 9, 2022

Does it mean that building fur the latest GHC compiler would still be better from the GitHub master? Because there's probably more to compiling a working HLS than having the bounds adjusted?

@Ailrun Ailrun added GHC issues with particular GHC versions and removed status: needs triage labels Jul 26, 2022
@July541 July541 mentioned this issue Jul 29, 2022
8 tasks
@hasufell
Copy link
Member

hasufell commented Jul 30, 2022

There have been major improvements about the ghcup compile hls command.

Documentation here:

E.g.

ghcup compile hls --git-ref master --git-describe-version --ghc 8.10.7 --ghc 9.2.4 --cabal-update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GHC issues with particular GHC versions type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants