<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120209>120209</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM_ENABLE_RUNTIMES: Failed to parse {json_file}: {e}
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
jhuber6
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Meinersbur
</td>
</tr>
</table>
<pre>
In certain situations when build the runtimes, the following soft error appears:
```
[ 56%/2.891s :: 4->31->45 (of 79)] Generating /home/meinersbur/build/llvm-project-flangrt/release_bootstrap/compile_commands.json
Failed to parse {json_file}: {e}
Failed to parse {json_file}: {e}
```
This happens during merging the stage1 `compile_commands.json` with the runtimes's `compile_commands.json` introduced in #116303. For instance, when one of the `compile_commands.json` is deleted.
I strongly suggest to not mess with the CMake-generated `compile_commands.json`.
First, the rule depends on its own output, potentially creating a dependency loop that will always re-run the command. Ninja seems to have a protection mechanism for the, but Make does not. When the command is run repeatedly, it will append `compile_commands.json` each time making the file grow and grow.
Second, `compile_commands.json` is created during the CMake configure phase, but the append rule runs at the build phase, and only when running the `all` target. That is, one gets inconcistent views of the file.
Third, the file may not exist for various reasons, for instance after `make clean`. It is only implemented for the Makefile and Ninja generator and will be missing for other generators. There might be [more cases](https://github.com/llvm/llvm-project/pull/110217#issuecomment-2536772017) that I could not reproduce.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVd9vo7gT_2ucl1ERmADNAw_JtnxVabsP3927e6wMTMBdYyOP3Vz--9NAku6tTr1bCSUkjD2fXx4UkR4sYi2Kg5DydYwt-lJIKYqHjYphdL5-Rm3RUxv9pnX9uX6y0KEPSlsgHaIK2lmC04gW2qhND2FE8NEGPSEJ-Wn5fXTGuJO2A5A7BkDvnQc1z6g8iXwv0uUq08uV7kVxgKIUshCykcn9LiPgunwP2zuRP-YZf24LEPLeHaHaCbkTxQP8Dy16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