Skip to content

LLVM_ENABLE_RUNTIMES: Failed to parse {json_file}: {e} #120209

Open
@Meinersbur

Description

@Meinersbur

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 that I could not reproduce.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions