Skip to content

Failed to generate compile_commands.json #53

@xulongwu4

Description

@xulongwu4

I ran the command bazel run @hedron_compile_commands//:refresh_all on the latest commit (bf40cc2), and it failed to generate the compile_commands.json file. If I go back one commit, the compile_commands.json file is generated successfully.

The error when running the bazel run command at commit bf40cc2 is as follows:

INFO: Analyzed target @@hedron_compile_commands+//:refresh_all (4 packages loaded, 2013 targets configured).
INFO: Found 1 target...
Target @@hedron_compile_commands+//:refresh_all up-to-date:
  bazel-bin/external/hedron_compile_commands+/refresh_all
  bazel-bin/external/hedron_compile_commands+/refresh_all.check_python_version.py
  bazel-bin/external/hedron_compile_commands+/refresh_all.py
INFO: Elapsed time: 1.648s, Critical Path: 0.38s
INFO: 9 processes: 7 internal, 2 linux-sandbox.
INFO: Build completed successfully, 9 total actions
INFO: Running command line: bazel-bin/external/hedron_compile_commands+/refresh_all
>>> Automatically added entries to .git/info/exclude to gitignore generated output.
>>> Automatically added //external workspace link:
    This link makes it easy for you--and for build tooling--to see the external dependencies you bring in. It also makes your source tree have the same directory structure as the build sandbox.
    It's a win/win: It's easier for you to browse the code you use, and it eliminates whole categories of edge cases for build tooling.
>>> Analyzing commands used in @//...
WARNING: Build options --features and --host_features have changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
>>> A source file you compile doesn't (yet) exist: bazel-out/k8-dbg/bin/external/+_repo_rules+llvm-project/clang/clang-driver.cpp
    It's probably a generated file, and you haven't yet run a build to generate it.
    That's OK; your code doesn't even have to compile for this tool to work.
    If you can, though, you might want to run a build of your code with --keep_going.
        That way everything possible is generated, browsable and indexed for autocomplete.
    However, if you have *already* built your code, and generated the missing file...
        Please make sure you're supplying this tool with the same flags you use to build.
        You can either use a refresh_compile_commands rule or the special -- syntax. Please see the README.
        [Supplying flags normally won't work. That just causes this tool to be built with those flags.]
    Continuing gracefully...
Traceback (most recent call last):
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/execroot/_main/bazel-out/k8-dbg/bin/external/hedron_compile_commands+/refresh_all.runfiles/_main/../hedron_compile_commands+/refresh_all.check_python_version.py", line 15, in <module>
    refresh_all.main()
    ~~~~~~~~~~~~~~~~^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/execroot/_main/bazel-out/k8-dbg/bin/external/hedron_compile_commands+/refresh_all.runfiles/hedron_compile_commands+/refresh_all.py", line 1420, in main
    compile_command_entries.extend(_get_commands(target, flags))
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/execroot/_main/bazel-out/k8-dbg/bin/external/hedron_compile_commands+/refresh_all.runfiles/hedron_compile_commands+/refresh_all.py", line 1282, in _get_commands
    yield from _convert_compile_commands(parsed_aquery_output)
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/execroot/_main/bazel-out/k8-dbg/bin/external/hedron_compile_commands+/refresh_all.runfiles/hedron_compile_commands+/refresh_all.py", line 1162, in _convert_compile_commands
    for source_files, header_files, compile_command_args in outputs:
                                                            ^^^^^^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/external/rules_python++python+python_3_13_x86_64-unknown-linux-gnu/lib/python3.13/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/external/rules_python++python+python_3_13_x86_64-unknown-linux-gnu/lib/python3.13/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ~~~~~~~~~~^^^^^^^^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/external/rules_python++python+python_3_13_x86_64-unknown-linux-gnu/lib/python3.13/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/external/rules_python++python+python_3_13_x86_64-unknown-linux-gnu/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/external/rules_python++python+python_3_13_x86_64-unknown-linux-gnu/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/execroot/_main/bazel-out/k8-dbg/bin/external/hedron_compile_commands+/refresh_all.runfiles/hedron_compile_commands+/refresh_all.py", line 1126, in _get_cpp_command_for_files
    source_files, header_files = _get_files(compile_action)
                                 ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/oulongwu/.cache/bazel/_bazel_oulongwu/5ea27db1debab93ecb57f96e7870f4b6/execroot/_main/bazel-out/k8-dbg/bin/external/hedron_compile_commands+/refresh_all.runfiles/hedron_compile_commands+/refresh_all.py", line 624, in _get_files
    assert source_file_candidates, f"No source files found in compile args: {compile_action.arguments}.\nPlease file an issue with this information!"
           ^^^^^^^^^^^^^^^^^^^^^^
AssertionError: No source files found in compile args: ['external/rules_cc++cc_configure_extension+local_config_cc/cc_wrapper.sh', '-xc++-header', '-fsyntax-only', '-U_FORTIFY_SOURCE', '-fstack-protector', '-Wall', '-Wunused-but-set-parameter', '-Wno-free-nonheap-object', '-fno-omit-frame-pointer', '-g', '-std=c++17', '-MD', '-MF', 'bazel-out/k8-dbg/bin/external/abseil-cpp+/absl/base/_objs/base/call_once.h.d', '-iquote', 'external/abseil-cpp+', '-iquote', 'bazel-out/k8-dbg/bin/external/abseil-cpp+', '-fdiagnostics-color=always', '-std=c++17', '-Wall', '-Wextra', '-Wcast-qual', '-Wconversion-null', '-Wformat-security', '-Wmissing-declarations', '-Wnon-virtual-dtor', '-Woverlength-strings', '-Wpointer-arith', '-Wundef', '-Wunused-local-typedefs', '-Wunused-result', '-Wvarargs', '-Wvla', '-Wwrite-strings', '-DNOMINMAX', '-c', 'external/abseil-cpp+/absl/base/call_once.h', '-o', 'bazel-out/k8-dbg/bin/external/abseil-cpp+/absl/base/_objs/base/call_once.h.processed', '-Wno-builtin-macro-redefined', '-D__DATE__="redacted"', '-D__TIMESTAMP__="redacted"', '-D__TIME__="redacted"'].
Please file an issue with this information!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions