rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
5.04k stars 325 forks source link

compile asan, but the content of compile_commands.json is empty #563

Open zhaohongjian520 opened 8 months ago

zhaohongjian520 commented 8 months ago

when I compile source code of gcc, I found that content of compile_commands.json not contain asan. then I try to compile asan separately, and the result is the same.

rizsotto commented 8 months ago

Hey @zhaohongjian520 , thanks for the report. What is asan? And how can I reproduce the separate build of it? (Would not want to compile the whole Gcc.)

WafiWadud commented 8 months ago

asan also known as libasan is a santizer https://github.com/google/sanitizers/wiki/AddressSanitizer

WafiWadud commented 8 months ago

compile instructions are https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild

nalajcie commented 7 months ago

Maybe check the compilation logs, compiling/cross-compiling gcc is a complex process, usually in stage 1 only the bare gcc is being build, which is then used to build libc, and then within stage 2 the full gcc (with libgcc and other necessary libs) is being built. Sometimes the stage1 compiler binary is being renamed to xgcc which bear doesn't recognize as compilator, try using --use-cc option to bear directly (I'm using Bear v2.4.4 but for v3 probably similar option exists).