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

Finding “wrapper” package locations (C++ LSP setup with Clang) #2471

Open
gcv opened this issue Jan 1, 2025 · 0 comments
Open

Finding “wrapper” package locations (C++ LSP setup with Clang) #2471

gcv opened this issue Jan 1, 2025 · 0 comments
Labels
feature New feature or request triage Issue needs triage

Comments

@gcv
Copy link

gcv commented Jan 1, 2025

What problem are you trying to solve?

I’m not sure this is a feature request or a bug report, but here goes:

I’m trying to set up a C++ development environment using Clang. I install clang using devbox, which includes clangd (LSP). The clang++ compiler works fine, but clangd requires some extra magic to find the right headers. (I use Meson as a build system, which may be part of the problem — its compile_commands.json generation, which clangd relies on, does not find any implicit headers.)

After several hours of trial and error, I found that the following .clangd file makes everything work:

CompileFlags:
  Add: [
    "-isystem/nix/store/xl0vlc2wdchfbq8536zs19pj2r3xdmma-clang-wrapper-19.1.5/resource-root/include/c++/v1",
    "-isystem/nix/store/xl0vlc2wdchfbq8536zs19pj2r3xdmma-clang-wrapper-19.1.5/resource-root/include",
    "-isystem/nix/store/kj8hbqx4ds9qm9mq7hyikxyfwwg13kzj-glibc-2.40-36-dev/include"
  ]

Which is horrible, because I don’t want to hardcode Nix store paths in my project.

Unfortunately, it looks like the necessary headers are only available in clang-wrapper. And glibc is a transitive dependency somewhere.

What solution would you like?

I’d like to have those derivations linked in my project’s .devbox directory. Is this possible?

Alternatives you've considered

I tried installing things like clang-unwrapped and that does not seem to have the necessary headers. Maybe I did it wrong.

@gcv gcv added feature New feature or request triage Issue needs triage labels Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request triage Issue needs triage
Development

No branches or pull requests

1 participant