Giter Site home page Giter Site logo

file '@rules_python//python:repositories.bzl' does not contain symbol 'python_register_toolchains' about bazel-compile-commands-extractor HOT 11 CLOSED

sjain-stanford avatar sjain-stanford commented on June 2, 2024
file '@rules_python//python:repositories.bzl' does not contain symbol 'python_register_toolchains'

from bazel-compile-commands-extractor.

Comments (11)

cpsauer avatar cpsauer commented on June 2, 2024 1

Also, I see Stanford in your username and am smiling :) (I'm a Stanford grad.)

from bazel-compile-commands-extractor.

cpsauer avatar cpsauer commented on June 2, 2024 1

Yep! Yay!

from bazel-compile-commands-extractor.

cpsauer avatar cpsauer commented on June 2, 2024

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.

cpsauer avatar cpsauer commented on June 2, 2024

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.

sjain-stanford avatar sjain-stanford commented on June 2, 2024

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.

sjain-stanford avatar sjain-stanford commented on June 2, 2024

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.

cpsauer avatar cpsauer commented on June 2, 2024

Might be worth poking them to update. This is one of the annoying things pre-bzlmod

from bazel-compile-commands-extractor.

sjain-stanford avatar sjain-stanford commented on June 2, 2024

@cpsauer happy to open a separate issue, but wanted to discuss here before doing that:

  1. 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.
  2. 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.

cpsauer avatar cpsauer commented on June 2, 2024

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.

sjain-stanford avatar sjain-stanford commented on June 2, 2024

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.

cpsauer avatar cpsauer commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.