Comments (11)
Also, I see Stanford in your username and am smiling :) (I'm a Stanford grad.)
from bazel-compile-commands-extractor.
Yep! Yay!
from bazel-compile-commands-extractor.
Hey Sambhav! That's no good--sorry. We just redid a bunch of python stuff to use Bazel's hermetic python and that might have messed things up. Are you using via bzlmod or WORKSPACE? Could I ask you to make sure you're using the latest commit? And in the meantime, to unblock you, could you hop on back to f41ec09 to make sure things work?
from bazel-compile-commands-extractor.
Hmm, was just running some tests to try to narrow this down, but things are working for me with both Bzlmod and WORKSAPCE. Maybe some other dependency is bringing in an old version of rules_python? Maybe try loading this tool first in your WORKSPACE to narrow that down?
from bazel-compile-commands-extractor.
Hey, thanks for the quick response. I'm using the WORKSPACE method. I will try your suggestions and get back shortly. Appreciate it.
from bazel-compile-commands-extractor.
Maybe some other dependency is bringing in an old version of rules_python? Maybe try loading this tool first in your WORKSPACE to narrow that down?
You're right. I was loading hedron_compile_commands towards the end of our WORKSPACE (here). Moving it to before bazel's buildifier definition seems to work around the initial issue with rules_python.
I get the following now, which probably means it worked? Excited to try it out! :D
>>> 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 //:tcp-opt
>>> A source file you compile doesn't (yet) exist: bazel-out/k8-fastbuild/bin/external/llvm-project/mlir/SerializeToCubin_stub.cc
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...
>>> Finished extracting commands for //:tcp-opt
from bazel-compile-commands-extractor.
Might be worth poking them to update. This is one of the annoying things pre-bzlmod
from bazel-compile-commands-extractor.
@cpsauer happy to open a separate issue, but wanted to discuss here before doing that:
- Is there a way to support builds run within a docker container, but run clangd on VSCode (using non-docker paths)? Right now the compile_commands.json uses
"directory": "/opt/src/mlir-tcp"
which exists within the container, and so VSCode's clangd is unable to render the suggestions. - Even with full compilation (
bazel run @hedron_compile_commands//:refresh_all
), there are still some symbols that are not recognized by clangd. Any tips on how to go about fixing these?
from bazel-compile-commands-extractor.
Hello again, Sambhav :)
Docker: I think I've heard of folks using it with (e.g. in issues), but I'm afraid I don't have personal experience yet. Would you be down to pioneer it, since you're using firsthand and can experiment and test (and I'm slammed, sorry :/). See the ImplementationReadme.md--it's easy to hack on this repo and test changes live.
Missing symbols: Is it that headers aren't being found or that they're the wrong headers (or something else)?
A couple possible culprits: (1) If top-level rules are configuring their dependencies, e.g. to cross-compile or put something into the docker container, you'll want to use a refresh_compile_commands rule to list the top level targets you build, like in the readme, rather than :refresh_all. Otherwise things won't be configured correctly, so it might look for the headers in the wrong places. (2) Might they be generated files that haven't been built yet (or are in the docker container)? I'm guessing from the warnings in the log you posted above, but I really don't have enough information yet here.
Thanks for sticking with the tool! I know how tricky bazel setup can be!
from bazel-compile-commands-extractor.
Hey Chris. I didn't get a chance to look into the docker issue yet. On the bright side, the missing symbols issue is resolved after adding all the top-level targets to the refresh_compile_commands
rule as you suggested (commit). I see all symbols are picked by clangd now! Thanks for all your help again.
from bazel-compile-commands-extractor.
Great! Delighted to hear :)
I took a quick peek at the docker instructions in your repo, btw. Still not an area I have experience with, unfortunately, but might vscode remote (i.e. dev inside the container) solve things?
from bazel-compile-commands-extractor.
Related Issues (20)
- nvcc fatal : Cannot find compiler 'cl.exe' in PATH HOT 4
- Relevant arguments are lost by the `bazel aquery ...` portion of compile command generation HOT 6
- protobufs not working in clangd HOT 1
- Suggested integration with VSCode HOT 1
- refreshAll failed to find C++ standard library if I specify '--sysroot' HOT 5
- clangd failed to find compilation database for dependency code HOT 6
- name 'module_extension' is not defined when used in Tensorflow-1.15.5 version HOT 4
- Linker error - collect2: fatal error: cannot find 'ld' HOT 1
- YCM reporting errors not present when code is actually built HOT 9
- sysroot handling is wrong in certain cases HOT 3
- Error when use with bazel --output_base flag HOT 5
- cuda_rules triggers assert "Something went wrong in makefile parsing to get headers. The target should be an object file."
- Third party library library from Bazel (sub)repository is not recognized HOT 3
- 'PurePosixPath' object has no attribute 'is_relative_to'
- When a giant project already has a folder called external in the root folder HOT 1
- Select usage example for refresh_compile_commands
- .o files appear in the current directory HOT 1
- When using the bazel module, how to define the refresh_command in BUILD HOT 12
- Suggestion: Custom Bazel binary path/name HOT 1
- Help us help this project by adopting a standard license 😁 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel-compile-commands-extractor.