hedronvision / bazel-compile-commands-extractor

Goal: Enable awesome tooling for Bazel users of the C language family.
Other
659 stars 109 forks source link

No source files found in compile args #200

Closed xiedeacc closed 2 months ago

xiedeacc commented 2 months ago

bazel version: release 7.2.0- (@non-git) os: ubuntu22.04

this project can recur this error https://github.com/xiedeacc/shadowsocks-packet

➜  shadowsocks-packet git:(master) ✗ bazel-7.2.0 run @hedron_compile_commands//:refresh_all
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=187
INFO: Reading rc options for 'run' from /root/src/shadowsocks/shadowsocks-packet/.bazelrc:
  Inherited 'build' options: --announce_rc --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 -c opt --copt=-g --copt=-O2 --copt=-Wall --cxxopt=-std=c++17 --strip=never --output_filter=^// --define=with_glog=true
INFO: Analyzed target @@hedron_compile_commands//:refresh_all (0 packages loaded, 3 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: 0.223s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/hedron_compile_commands/refresh_all
>>> Automatically added entries to .git/info/exclude to gitignore generated output.
>>> 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).
Traceback (most recent call last):
  File "/root/.cache/bazel/_bazel_root/8d8d69296c265cfafd5085c0c5869348/execroot/_main/bazel-out/k8-opt/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 "/root/.cache/bazel/_bazel_root/8d8d69296c265cfafd5085c0c5869348/execroot/_main/bazel-out/k8-opt/bin/external/hedron_compile_commands/refresh_all.py", line 1417, in main
    compile_command_entries.extend(_get_commands(target, flags))
  File "/root/.cache/bazel/_bazel_root/8d8d69296c265cfafd5085c0c5869348/execroot/_main/bazel-out/k8-opt/bin/external/hedron_compile_commands/refresh_all.py", line 1279, in _get_commands
    yield from _convert_compile_commands(parsed_aquery_output)
  File "/root/.cache/bazel/_bazel_root/8d8d69296c265cfafd5085c0c5869348/execroot/_main/bazel-out/k8-opt/bin/external/hedron_compile_commands/refresh_all.py", line 1159, in _convert_compile_commands
    for source_files, header_files, compile_command_args in outputs:
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
    yield _result_or_cancel(fs.pop())
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
    return fut.result(timeout)
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/root/.cache/bazel/_bazel_root/8d8d69296c265cfafd5085c0c5869348/execroot/_main/bazel-out/k8-opt/bin/external/hedron_compile_commands/refresh_all.py", line 1123, in _get_cpp_command_for_files
    source_files, header_files = _get_files(compile_action)
  File "/root/.cache/bazel/_bazel_root/8d8d69296c265cfafd5085c0c5869348/execroot/_main/bazel-out/k8-opt/bin/external/hedron_compile_commands/refresh_all.py", line 627, 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/bazel_tools~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', '-g0', '-O2', '-D_FORTIFY_SOURCE=1', '-DNDEBUG', '-ffunction-sections', '-fdata-sections', '-std=c++14', '-MD', '-MF', 'bazel-out/k8-opt/bin/external/com_google_absl/absl/strings/_objs/strings/ascii.h.d', '-iquote', 'external/com_google_absl', '-iquote', 'bazel-out/k8-opt/bin/external/com_google_absl', '-g', '-O2', '-Wall', '-D_GLIBCXX_USE_CXX11_ABI=1', '-std=c++17', '-Wall', '-Wextra', '-Wcast-qual', '-Wconversion-null', '-Wformat-security', '-Wmissing-declarations', '-Woverlength-strings', '-Wpointer-arith', '-Wundef', '-Wunused-local-typedefs', '-Wunused-result', '-Wvarargs', '-Wvla', '-Wwrite-strings', '-DNOMINMAX', '-Wno-builtin-macro-redefined', '-D__DATE__="redacted"', '-D__TIMESTAMP__="redacted"', '-D__TIME__="redacted"', '-c', 'external/com_google_absl/absl/strings/ascii.h', '-o', 'bazel-out/k8-opt/bin/external/com_google_absl/absl/strings/_objs/strings/ascii.h.processed'].
Please file an issue with this information!
xiedeacc commented 2 months ago

same with https://github.com/hedronvision/bazel-compile-commands-extractor/issues/199 for some target just process header file