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

Add option to extract vendored headers to stable path #571

Open
connorworley opened this issue Aug 30, 2023 · 2 comments
Open

Add option to extract vendored headers to stable path #571

connorworley opened this issue Aug 30, 2023 · 2 comments

Comments

@connorworley
Copy link

I'd like to run clang-tidy on my C code. I can add a clang arg to generate compilation command JSON, but it ends up referring to temporary include paths:

{ "directory": "/Users/cworley/Code/program-template", "file": "src/bpf/template.bpf.c", "output": "/tmp/.tmpR5UzRB/template.o", "arguments": ["/usr/lib/llvm-14/bin/clang", "-xc", "src/bpf/template.bpf.c", "-D", "__TARGET_ARCH_x86", "-I", "/tmp/.tmp5F6kvc/bpf/src", "-fno-stack-protector", "-g", "-O2", "--target=bpf", "-c", "-o", "/tmp/.tmpR5UzRB/template.o", "--target=bpf"]},

It would be nice if there was a way to extract these vendored headers to a stable path such that they still exist when I run clang-tidy.

@danielocfb
Copy link
Collaborator

To the degree I can tell the headers will be extracted somewhere below the target directory. How you set that is up to you and depends on how you generate the bindings. Please show the complete working example if that doesn't help.

@connorworley
Copy link
Author

Refer to

let header_parent_dir = tempdir()?;
let header_dir = extract_libbpf_headers_to_disk(header_parent_dir.path())?;
-- the headers are extracted to a temporary directory.

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

No branches or pull requests

2 participants