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

clangd: Missing libz.so.1 when running clangd #391356

Open
3 tasks done
i-ilak opened this issue Mar 19, 2025 · 0 comments
Open
3 tasks done

clangd: Missing libz.so.1 when running clangd #391356

i-ilak opened this issue Mar 19, 2025 · 0 comments
Labels
0.kind: bug Something is broken

Comments

@i-ilak
Copy link

i-ilak commented Mar 19, 2025

Nixpkgs version

  • Unstable (25.05)

Describe the bug

This issue came up when configuring nixvim. The same configuration was working until ~3 weeks.

Field Description
Plugin lsp
Nixpkgs nixos-unstable
Home Manager 24.11-pre

Description

Whenever I run nixvim with my configuration on a C++ codebase, that starts lsp, I see an error of this form:

[ERROR][2025-03-18 15:28:34] .../vim/lsp/rpc.lua:770	"rpc"	"/nix/store/zqdqx2z1sng4yqqbwz8cga0dgwv3r37p-clang-tools-18.1.8/bin/clangd"	"stderr"	"/nix/store/zqdqx2z1sng4yqqbwz8cga0dgwv3r37p-clang-tools-18.1.8/bin/clangd: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory\n"

Any idea why this shared object ins not in the LD_LIBRARY_PATH, or symlinked to the default locations Linux expects?

Steps to reproduce

The setup looks something like this (apologies if this is not the most minimal example, but I'm not 100% sure in which part the error happens...)

#flake.nix
nvim = nixvim'.makeNixvimWithModule {
  inherit pkgs;
  module = ./config;
};

#config/default.nix
{}:
{
  imports = [
    lsp.nix
  ];
}

#lsp.nix
{ pkgs
, ...
}: {
  plugins = {
    lsp-format = {
      enable = true;
    };
    lsp = {
      enable = true;
      servers = {
        clangd = {
          enable = true;
          package = pkgs.llvmPackages_18.clang-tools;
          cmd = [
            "clangd"
            "--offset-encoding=utf-16"
            "--background-index"
            "-j"
            "20"
            "--clang-tidy"
          ];
        };
      };
    };
  };
}

Which is the used like this in a configuration:

#flake.nix
{
  inputs = {
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    nixvim = {
      url = "github:i-ilak/nixvim-config";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
  }

  outputs = {
    ...
    } @ inputs 
  : {
      homeConfigurations = {
        # some deeper nesting, but in the end
        home.packages = [
                inputs.nixvim.packages.${pkgs.system}.default
        ];
      };
    };
}

Regardless of pkgs.clang-tools, or pkgs.llvmPackages_18.clang-tools, the issue persists.

Expected behaviour

For clangd to start normally and work.

Screenshots

No response

Relevant log output

Additional context

Double checking with nixvim maintainer here, indicate that this is a clangd issue.

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.8.0-51-generic, Ubuntu, 24.04.1 LTS (Noble Numbat), nobuild
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.25.3
  • nixpkgs: /nix/store/shh5sdqk4h0s482fxyyw6v5hhljapby9-source

Notify maintainers

@Patryk27


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

@i-ilak i-ilak added the 0.kind: bug Something is broken label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant