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

swiProlog with lsp in extraPacks no longer builds #336326

Open
MathiasSven opened this issue Aug 21, 2024 · 4 comments · May be fixed by #340314
Open

swiProlog with lsp in extraPacks no longer builds #336326

MathiasSven opened this issue Aug 21, 2024 · 4 comments · May be fixed by #340314
Assignees

Comments

@MathiasSven
Copy link
Contributor

Describe the bug

It seems that swiProlog errors with Could not find executable file "git" in $PATH when attempting to have jamesnvc/lsp_server in extraPacks. There has been no updates in the lsp_server. I came across this while trying to update my systems. Currently, swipl --version says SWI-Prolog version 9.1.21 for x86_64-linux, so that was the last build I had with the lsp not causing a build failure.

Steps To Reproduce

Steps to reproduce the behavior:

  1. build this expression:
( 
  # HEAD as of writing this GH Issue.
  with (import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/8cdbfd38e917317cb07e760c8efaf2d0db04b705.tar.gz) {}); let
    prolog-language-server = fetchFromGitHub {
      owner = "jamesnvc";
      repo = "lsp_server";
      rev = "v2.2.11";
      hash = "sha256-6MYFulJsTTAKVtsFwLJy7Rn1d9ZlrD+EwpH93BA/GgQ=";
    };
  in
  swiProlog.override {
    extraPacks = [ "'file://${prolog-language-server}'" ];
  }
)

Build log

error: builder for '/nix/store/42b4knlisal6g26p5ywv30i17qgp85gd-swi-prolog-9.2.6.drv' failed with exit code 2;
       last 10 log lines:
       > [38/40] Build home/library/ext/tipc/tipc/INDEX.pl
       > [39/40] Build home/library/ext/ssl/INDEX.pl
       > [39/40] Install the project...
       > -- Install configuration: "Release"
       > -- Set non-toolchain portion of runtime path of "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/bin/x86_64-linux/swipl" to "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/lib/x86_64-linux"
       > -- Set non-toolchain portion of runtime path of "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/libswipl.so.9.2.6" to "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/lib/x86_64-linux"
       > -- Set non-toolchain portion of runtime path of "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/bin/x86_64-linux/swipl-ld" to "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/lib/x86_64-linux"
       > -- Set non-toolchain portion of runtime path of "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/lib/x86_64-linux/libjpl.so" to "/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/lib/x86_64-linux:/nix/store/wriyrcklxnxbfr7f4ymirscmrh96kh88-openjdk-21.0.3+9/include:/nix/store/wriyrcklxnxbfr7f4ymirscmrh96kh88-openjdk-21.0.3+9/lib/openjdk/lib/server"
       > /homeless-shelter: No such file or directory
       > ERROR: -g pack_install('file:///nix/store/6l17gg2g0q8cjsbhlxa39c9mxw5zp6fx-source', [package_directory("/nix/store/ymi7vc46jxxwvrxbc0nxk77jkp0q8ksc-swi-prolog-9.2.6/lib/swipl/extra-pack"), silent(true), interactive(false)]).: Could not find executable file "git" in $PATH
       For full logs, run 'nix log /nix/store/42b4knlisal6g26p5ywv30i17qgp85gd-swi-prolog-9.2.6.drv'.

Additional Context

It seems this started happening in 9.2.5. Works fine on the parent commit.

Notify maintainers

@meditans @matko

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.8, NixOS, 24.11 (Vicuna), 24.11.20240709.feb2849`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.4`
 - channels(root): `""`
 - channels(mathiassven): `"home-manager"`
 - nixpkgs: `/nix/store/xr9wjzx0cdnwkmhzz74h8lphgn5jmyv3-source`

Add a 👍 reaction to issues you find important.

@MathiasSven
Copy link
Contributor Author

It seems adding git to buildInputs allows it to build, it is not clear to me how git is being used here as I am not familiar with how packs work in swiProlog and why 9.2 made this necessary. From looking at that commit in nixpkgs, it appears to be something that changed upstream.

This builds:

(
  with (import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/8cdbfd38e917317cb07e760c8efaf2d0db04b705.tar.gz) {}); let
    prolog-language-server = fetchFromGitHub {
      owner = "jamesnvc";
      repo = "lsp_server";
      rev = "v2.2.11";
      hash = "sha256-6MYFulJsTTAKVtsFwLJy7Rn1d9ZlrD+EwpH93BA/GgQ=";
    };
  in
  swiProlog.override {
    extraPacks = [ "'file://${prolog-language-server}'" ];
  }
).overrideAttrs (final: prev: { buildInputs = prev.buildInputs ++ [ git ];})

@matko
Copy link
Contributor

matko commented Aug 21, 2024

I can confirm that with 9.1.21, swi-prolog + lsp-server builds just fine, even with the latest packaging. Something must indeed have changed upstream. 9.1.22 is the first version that stops building for me.
The changelog notes that the pack system got a refactor at that point, so that's probably what is going on here, but nothing indicates a sudden need for git.

If git is now necessary for pack installation (even if we already pre-cloned everything) it should be a dependency.

@JanWielemaker any idea why git became necessary here?

@matko
Copy link
Contributor

matko commented Aug 22, 2024

We can resolve this with a patch to SWI-Prolog to respect git(false) in the pack_install options, then adding that option to our invocation.

I submitted a PR to SWI-Prolog (SWI-Prolog/swipl-devel#1307). If upstream merges this, we can just apply the same patch to stable.

@matko matko self-assigned this Aug 22, 2024
@matko matko linked a pull request Sep 7, 2024 that will close this issue
13 tasks
@matko
Copy link
Contributor

matko commented Sep 7, 2024

swi-prolog 9.2.7 backported the PR mentioned above. I've modified the package definition to supply the proper flag which suppresses git use during extraPacks install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants