hedronvision / bazel-compile-commands-extractor

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

No source files found in compile args #204

Open kuntryn opened 4 months ago

kuntryn commented 4 months ago

got this error when compiling abseil library.

 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', '-Wthread-safety', '-Wself-assign', '-Wunused-but-set-parameter', '-Wno-free-nonheap-object', '-fcolor-diagnostics', '-fno-omit-frame-pointer', '-g', '-std=c++17', '-MD', '-MF', 'bazel-out/k8-dbg/bin/external/abseil-cpp~/absl/log/_objs/absl_log/absl_log.h.d', '-iquote', 'external/abseil-cpp~', '-iquote', 'bazel-out/k8-dbg/bin/external/abseil-cpp~', '-std=c++20', '-Xclang', '-fno-modules-validate-textual-header-includes', '-Wall', '-Wextra', '-Wcast-qual', '-Wconversion', '-Wfloat-overflow-conversion', '-Wfloat-zero-conversion', '-Wfor-loop-analysis', '-Wformat-security', '-Wgnu-redeclared-enum', '-Winfinite-recursion', '-Winvalid-constexpr', '-Wliteral-conversion', '-Wmissing-declarations', '-Woverlength-strings', '-Wpointer-arith', '-Wself-assign', '-Wshadow-all', '-Wshorten-64-to-32', '-Wsign-conversion', '-Wstring-conversion', '-Wtautological-overlap-compare', '-Wtautological-unsigned-zero-compare', '-Wundef', '-Wuninitialized', '-Wunreachable-code', '-Wunused-comparison', '-Wunused-local-typedefs', '-Wunused-result', '-Wvla', '-Wwrite-strings', '-Wno-float-conversion', '-Wno-implicit-float-conversion', '-Wno-implicit-int-float-conversion', '-Wno-unknown-warning-option', '-DNOMINMAX', '-no-canonical-prefixes', '-Wno-builtin-macro-redefined', '-D__DATE__="redacted"', '-D__TIMESTAMP__="redacted"', '-D__TIME__="redacted"', '-c', 'external/abseil-cpp~/absl/log/absl_log.h', '-o', 'bazel-out/k8-dbg/bin/external/abseil-cpp~/absl/log/_objs/absl_log/absl_log.h.processed'].
Please file an issue with this information!

https://github.com/hedronvision/bazel-compile-commands-extractor/blob/1e08f8e0507b6b6b1f4416a9a22cf5c28beaba93/refresh.template.py#L613-L621

This command seems try to generate a preprocessed header file, so it contains no cpp source files.

eugeneo commented 4 months ago

I see the same issue. I think this got broken with the Bazel update:

File "/home/eostroukhov/.cache/bazel/_bazel_eostroukhov/628ec0af40d0d4acacd38321172c53ed/execroot/_main/bazel-out/k8-fastbuild/bin/external/hedron_compile_commands~/refresh_all.py", line 628, 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', '-Wthread-safety', '-Wself-assign', '-Wunused-but-set-parameter', '-Wno-free-nonheap-object', '-fcolor-diagnostics', '-fno-omit-frame-pointer', '-std=c++14', '-MD', '-MF', 'bazel-out/k8-fastbuild/bin/external/abseil-cpp~/absl/log/_objs/log/log.h.d', '-iquote', 'external/abseil-cpp~', '-iquote', 'bazel-out/k8-fastbuild/bin/external/abseil-cpp~', '-std=c++20', '-Wall', '-Werror', '-fno-exceptions', '-Wall', '-Wextra', '-Wcast-qual', '-Wconversion', '-Wfloat-overflow-conversion', '-Wfloat-zero-conversion', '-Wfor-loop-analysis', '-Wformat-security', '-Wgnu-redeclared-enum', '-Winfinite-recursion', '-Winvalid-constexpr', '-Wliteral-conversion', '-Wmissing-declarations', '-Woverlength-strings', '-Wpointer-arith', '-Wself-assign', '-Wshadow-all', '-Wshorten-64-to-32', '-Wsign-conversion', '-Wstring-conversion', '-Wtautological-overlap-compare', '-Wtautological-unsigned-zero-compare', '-Wundef', '-Wuninitialized', '-Wunreachable-code', '-Wunused-comparison', '-Wunused-local-typedefs', '-Wunused-result', '-Wvla', '-Wwrite-strings', '-Wno-float-conversion', '-Wno-implicit-float-conversion', '-Wno-implicit-int-float-conversion', '-Wno-unknown-warning-option', '-DNOMINMAX', '-no-canonical-prefixes', '-Wno-builtin-macro-redefined', '-D__DATE__="redacted"', '-D__TIMESTAMP__="redacted"', '-D__TIME__="redacted"', '-c', 'external/abseil-cpp~/absl/log/log.h', '-o', 'bazel-out/k8-fastbuild/bin/external/abseil-cpp~/absl/log/_objs/log/log.h.processed'].
Please file an issue with this information!
eugeneo commented 4 months ago

Made a lazy and likely wrong fix, but being in a hurry. Can be used by adding this to MODULE.bazel:

git_override(
    module_name = "hedron_compile_commands",
    remote = "https://github.com/eugeneo/bazel-compile-commands-extractor.git",
    commit = "844279a911d0a0adca480b299799f03f65290cce",
)

Would appreciate any suggestions on how to fix this properly.

rockwotj commented 3 months ago

Duplicate of https://github.com/hedronvision/bazel-compile-commands-extractor/issues/199