ghcup-hs icon indicating copy to clipboard operation
ghcup-hs copied to clipboard

Pagesize issue with hls installed through ghcup

Open aikrahguzar opened this issue 1 year ago • 3 comments

I have been using Asahi Linux which uses 16k pagesize for the past year or so. ghcup has worked perfectly on it. However today the hls died on me repeatedly. Checking log I see errors like:

.../share/ghcup/hls/2.9.0.1/lib/haskell-language-server-2.9.0.1/bin//haskell-language-server-9.8.2: error while loading shared libraries: libHSlibyaml-clib-0.2.5-b4e3b7f53c6f0e5b9f03710fec1a2dfaf4b1a44cd493ad6e2de7ecba6d945d76-ghc9.8.2.so: ELF load command address/offset not page-aligned

This happens with hls-2.9.0.1, hls-2.9.0.0 and hls-2.8.0.0. hls-2.7.0.0 works.

Maybe something changed and the aarch64 binaries for hls are now using 4k pagesize?

aikrahguzar avatar Oct 25 '24 13:10 aikrahguzar

I have no idea.

CCing @angerman @wz1000

hasufell avatar Oct 25 '24 14:10 hasufell

I'm also on Asahi Linux. I'm not familiar with how page size affects the build, but as another data point, I've found that compiling locally with ghcup compile hls --version 2.9.0.0 --ghc 9.4.8 solves the issue. I'll try to investigate how asset compilation has changed upstream to see what introduced the incompatibility.

vemek avatar Dec 01 '24 23:12 vemek

I am not sure how or where exactly hls is built for ghcup, but I suspect this issue might be https://github.com/NixOS/patchelf/issues/79, which is that patchelf used to use the host page size, which isn't correct on architectures where the binary might be run on systems with a larger page size (ld itself already defaults the page size to 64KiB on arm64). This was fixed in patchelf 0.12, but the patchelf version in Debian 10 is 0.9, which seems to indeed use a compile-time fixed page size. if that is indeed the issue, then "just" building haskell-language-server with make PATCHELF='patchelf --page-size $(64*1024)' should fix this.

refi64 avatar Mar 31 '25 23:03 refi64