-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Haskell language server fails to build on aarch64-darwin #194367
Comments
this has come up on reddit already, but I will repeat parts of my answer here, becaus reddit. https://www.reddit.com/r/haskell/comments/xpjibu/comment/iq64vkp/ Sorry you are having such a bad time. Sadly I have no clue about darwin or debugging capabilities for it. For a temporary workaround, I would accept a PR which disables the broken plugin(s) on M1, assuming it’s a package specific problem. The reddit user mentions it could be an outdated clang version, I have no clue if that assessments has any merits … |
Oh, sorry, I had overlooked the last line of your report. We can try haskell-language-server = disableCabalFlag "fourmolu" super.haskell-language-server.override { hls-fourmolu-plugin = null; } either in a local override of your nixpkgs (be careful to apply it to or in nixpkgs in |
Thanks very much, that gives me enough to get going. I'll have a play, it may take some time, I seem to end up building a lot when doing this sort of thing. |
that shouldn‘t be the case. maybe you are not using a cached commit? i am not sure what channel to follow with aarch64 darwin, but master is probably a bad idea. in fact having a look at hydra here: https://hydra.nixos.org/jobset/nixpkgs/nixpkgs-unstable-aarch64-darwin#tabs-jobs I see that all plugins are actually successfully being built (search for hls-). otoh hls itself has indeed failed in the step of building ormolu, so here things are getting complicated. Let me quickly describe the situation: That this can happen at all is probably caused by some override which makes the ormolu hls uses slightly different from the one used in the hls-ormolu-plugin. That‘s a pretty frustrating situation in itself, but there were technical limitations and I had been working on hls for 2 full days at that point. Anyway why can the one fail while the other doesn’t? Either the build is somehow flaky and the one job had luck while the relevant one didn’t or the override actually causes the linker problem to happen. I am not willing to place any bets, the first explanation maybe is a bit more likely, especially since our darwin builders have been shaky in the last weeks, but it could be something completely different. |
Thanks again @maralorn, disabling the plugins helps. Here's what I did Originally, my (much simplified) shell.nix looked like this: let hsl = nixPkgs.haskell-language-server.override {
supportedGhcVersions = [ "924" ];
dynamic = true;
}
in nixPkgs.mkShell {
buildInputs = [ hsl ];
} If I change it to this let
disableCabalFlag = nixPkgs.haskell.lib.disableCabalFlag;
hslWithoutPlugins = nixPkgs.haskellPackages.haskell-language-server.override {
hls-fourmolu-plugin = null;
hls-ormolu-plugin = null;
};
withoutFourmoluFlag = disableCabalFlag hslWithoutPlugins "fourmolu";
hsl = disableCabalFlag withoutFourmoluFlag "ormolu";
in nixPkgs.mkShell {
buildInputs = [ hsl ];
} the shell loads, if my project ghc version matched the default "90" I'd be all good. I was using the top level attribute Dynamic is no longer needed, it has recently been made the default, and as I only need a single ghc version I can specify this also. Now my new shell.nix looks like this: let
disableCabalFlag = nixPkgs.haskell.lib.disableCabalFlag;
hslWithoutPlugins = nixPkgs.haskell.packages.ghc924.haskell-language-server.override {
hls-fourmolu-plugin = null;
hls-ormolu-plugin = null;
};
withoutFourmoluFlag = disableCabalFlag hslWithoutPlugins "fourmolu";
hsl = disableCabalFlag withoutFourmoluFlag "ormolu";
in nixPkgs.mkShell {
buildInputs = [ hsl ];
} The shell loads again, and I think this will probably work for most people. I can't be sure, because it doesn't work for me, I still have different GHC versions, probably because I'm using two different nix pins (and haskell.nix), I'm going to play with that a bit more now. |
I struggled a bit getting a compatible GHC with the one HSL was built with, I could get the versions to match but I was getting 'GHC ABIs don't match!' error. I'm also using haskell.nix which made it harder because all I should have in my nix file is: hsl = haskell.tool ghcVersion "haskell-language-server" "latest"; In the end, I used a global overlay. I added self: super:
let
disableCabalFlag = super.haskell.lib.disableCabalFlag;
hsl1 = super.haskell-language-server.override {
hls-fourmolu-plugin = null;
hls-ormolu-plugin = null;
};
hsl2 = disableCabalFlag hsl1 "fourmolu";
hsl = disableCabalFlag hsl2 "ormolu";
in
{
haskell-language-server = hsl;
} Then updated my nix path
and for the first time I'm running haskell language server natively on my M1. Thanks to everyone involved. |
@tom-hodgson yeah, in general haskell-language-server from nixpkgs will not work for a project built with haskell.nix, be careful with that. You might get away with it if you don’t use TemplateHaskell. |
I also hit this issue (i am the original reddit poster), and your solution does help for HLS @maralorn , thanks! no idea why it's so hard to understand the overriding APIs for different packages, so your tip is quite useful (to use however the segfault on clang still occurs in other packages, like ormolu's 0.5.0.1 version and Agda, which is why i don't think the solution here is sustainable and might just reflect a more general issue in nixpkgs for M1 mac, and not specifically the fault of broken packages for the HLS plugins. I created another reddit post on the much more general topic of overriding clang (nicely illustrates how I suck at Nix) https://www.reddit.com/r/Nix/comments/y16z7w/how_to_override_clang_in_macos/ |
This should be fixed in #196781. It's not a true fix for the issue, but works around it because it seems to be caused by heavy use of Template Haskell. Ormolu/Fourmolu has a flag to disable TH usage at the expense of runtime performance (though it's basically unnoticeable). |
Is this still an issue? Can this issue be closed? |
How can I help test this? I have a M1 Pro. Currently, HLS is failing to build because of :
EDIT: of #140774 |
Exactly, that's #140774 (comment). Then I'll close this for now and we can revisit this as soon as the blocking issue is fixed. |
Steps To Reproduce
taking the most recent commit:
Errors with
It looks similiar to #149692 but I think this (haskell language server) will affect a wider audience.
I'm not convinced its fourmolu (or ormolu) specific because both of these commands work fine for me:
I've read that it may be possible to remove fourmolu from the list of plugins, but I've not been able to find how to do this.
Notify maintainers
@maralorn
Metadata
The text was updated successfully, but these errors were encountered: