compdb icon indicating copy to clipboard operation
compdb copied to clipboard

Error while adding headers

Open BSB47 opened this issue 2 years ago • 2 comments

Hi, I'm getting an error while using compdb -p ./ list > compile_commands.json:

File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

causing compdb to end with code 1. Any idea what is causing this? Thank you

BSB47 avatar Apr 25 '22 23:04 BSB47

Same for me.

afrischk avatar May 06 '22 14:05 afrischk

That happens because compile_commands.json gets modified while compdb is reading from it. You can get around this issue by writing to a temporary file first, e.g:

compdb -p ./ list > temp && mv temp compile_commands.json

Or by using some other method to ensure the command finishes before writing to the compile_commands.json file.

AquaVirus avatar Jun 17 '22 04:06 AquaVirus