Conversation
Edited 1 year ago
https://social.kernel.org/notice/AUYMfmHof5yHSkpLJA

Huh, so I finally figured out tonight why this was happening (and it was bothering me for months with false positives) but the attached pushed me to actually fix it.

The script in Linux to generate compile_commands.json takes a few arguments. There's a positional one:
"paths
directories to search or files to parse (files should be *.o, *.a, or modules.order). If nothing is specified, the current directory is searched"
and an optional one:
"-d DIRECTORY, --directory DIRECTORY
specify the output directory used for the kernel build (defaults to the working directory)"

Turns out that passing the build directory as one of the positional arguments is a no-go, as it will *mostly* work, but not pick up things like the kernels types (u32 etc) nor be able to use the symbols defined from Kconfig.
Instead, shoulda been passing it as --directory...

Call me biased, but perhaps the help text is not clear enough given doing it wrong "almost" works!
1
0
2
I've been doing this wrong for a year and tried to fix it several times without noticing that that was my problem.
0
0
1