Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No source files found in compile args #204

Open
kuntryn opened this issue Jul 4, 2024 · 3 comments
Open

No source files found in compile args #204

kuntryn opened this issue Jul 4, 2024 · 3 comments

Comments

@kuntryn
Copy link

kuntryn commented Jul 4, 2024

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!

def _get_files(compile_action):
"""Gets the ({source files}, {header files}) clangd should be told the command applies to."""
# Getting the source file is a little trickier than it might seem.
# First, we do the obvious thing: Filter args to those that look like source files.
source_file_candidates = [arg for arg in compile_action.arguments if not arg.startswith('-') and arg.endswith(_get_files.source_extensions)]
assert source_file_candidates, f"No source files found in compile args: {compile_action.arguments}.\nPlease file an issue with this information!"
source_file = source_file_candidates[0]

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

@eugeneo
Copy link

eugeneo commented Jul 10, 2024

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
Copy link

eugeneo commented Jul 18, 2024

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
Copy link

rockwotj commented Aug 1, 2024

Duplicate of #199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants