Add option to extract vendored headers to stable path
connorworley opened this issue · comments
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.
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.
Refer to
libbpf-rs/libbpf-cargo/src/build.rs
Lines 292 to 293 in aacaec1