-
Notifications
You must be signed in to change notification settings - Fork 112
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 error #199
Comments
same error |
I also have this issue. The logic in |
diff --git a/refresh.template.py b/refresh.template.py
index 3b33701..acc5f90 100644
--- a/refresh.template.py
+++ b/refresh.template.py
@@ -615,6 +615,11 @@ def _get_files(compile_action):
# Getting the source file is a little trickier than it might seem.
+ is_precompiled_header = any([arg == "-xc++-header" for arg in compile_action.arguments])
+ if is_precompiled_header:
+ header_files = [arg for arg in compile_action.arguments if not arg.startswith('-') and arg.endswith(".h")]
+ return set(), set(header_files)
+
# 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!" This patch works for me. |
That's odd. I had |
In any case, this patched worked for me as well. @ehuang3 can you open a PR? |
I started having the same problem in my project. The error also triggers on abseil's header file. I created a small repository so that reproducing is easier. https://github.com/tolikzinovyev/hedron-fail Arch Linux, Bazel 7.2.0 |
|
Can someone please open a PR for this? |
Hey guys--I'm seeing this and will engage with it shortly, aiming for this weekend. Sorry to be only getting to this now; I've been underwater with other things. Seems like bazel added a new type of header-only compile action, when formerly they only issued them for source files. I think the first step is to understand what's going on in those actions to make sure there aren't other problems and figure out if there's another way to distinguish them (in case the problem happens also with, e.g. c (not c++) headers, breaking the solution above). Awesome to have a minimal reproduction case and know the Bazel version that broke it--thanks guys. If anyone is willing to help in the meantime, I think the next steps would be
|
Likely Related PR: bazelbuild/bazel#22369 |
I've also confirmed this still happens in Bazel rolling at least for abseil in my repo |
Had to downgrade Bazel to 7.1.2 because it was crashing when building abseil. See issue: hedronvision/bazel-compile-commands-extractor#199
I ran into the same issue on one of my repos. And got it working with #209 The problem is that the source file a header ( That one also adds support for However, it does not support all header extension variants ('.hh', '.hpp', '.hxx' and whatnot). So it might be necessary to adding them all and to only use |
@fmeum sorry to pull you into this, but I believe that bazelbuild/bazel#22369 caused this (because downgrading to Bazel 7.1.0 makes this error go away). Do you know the details of the purpose of the |
The While the file itself isn't interesting, the action very well could be. For a header-only library with no consumers, it does provide flags with which the library at least parses correctly. That makes an approach such as #209 look reasonable to me. I am working on adding a new action that supports C headers (via |
Thanks for confirming @fmeum. The header only libraries get their own entries this way. Which imo is a clear improvement. |
I have this issue if I use boost.move: MODULE.bazel
BUILD
Error
|
I've been using the following patch for this issue: #219 |
I confirm it works in my case. |
I recently started getting a
No source files found in compile args
error while runningrefresh_compile_commands
. The error message told me to file an issue for this.Repository is here: https://github.com/davidzchen/bazel-ycm-test
System Info
OS: macOS 14.4.1 Sonoma
Bazel/Bazelisk version:
Python version:
The text was updated successfully, but these errors were encountered: