nix-community / nix-vscode-extensions

Nix expressions for VSCode and OpenVSX extensions [maintainers: @deemp, @AmeerTaweel]
MIT License
169 stars 9 forks source link

Extension vadimcn.vscode-lldb fails with error "/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.35' not found" #52

Closed avermel closed 3 months ago

avermel commented 5 months ago

The problem happens on a non-NixOS linux machine with a rather old distro. I am able to run the extension by applying patchelf to the extension binaries as:

pathToZlib = pkgs.lib.makeLibraryPath [ pkgs.zlib ];

my-vscode-lldb  =  vscode-market.vadimcn.vscode-lldb.overrideAttrs (oldAttrs: {
    postInstall = ''
    cd "$out/$installPrefix"
    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./adapter/codelldb
    patchelf --add-rpath "${pathToZlib}" ./lldb/lib/liblldb.so
    '';
});
deemp commented 5 months ago

Cool! If you have time, please, make a PR for this issue.

  1. Add this override to overrides.nix so that the file looks like this:

    ...
    updateExtensions {
      # https://github.com/nix-community/nix-vscode-extensions/issues/31
      asf.apache-netbeans-java = _: { sourceRoot = "extension"; };
      # https://github.com/nix-community/nix-vscode-extensions/issues/52
      vadimcn.vscode-lldb = _: {
        postInstall = ''
          cd "$out/$installPrefix"
          patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./adapter/codelldb
          patchelf --add-rpath "${pkgs.lib.makeLibraryPath [ pkgs.zlib ]}" ./lldb/lib/liblldb.so
        '';
      };
    }
  2. The default package is a VSCodium with vadimcn.vscode-lldb. Run it (e.g., nix run .# .) and confirm in the PR that the extension works.

  3. Describe in the PR description how to test that it works.

deemp commented 3 months ago

Closed by https://github.com/nix-community/nix-vscode-extensions/commit/88eb88c27b28cab7a7c08e3bfa392b0205dbe9dd