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

[bazel] OpenTitan as a Bazel module dependency #25849

Open
jwnrt opened this issue Jan 13, 2025 · 3 comments
Open

[bazel] OpenTitan as a Bazel module dependency #25849

jwnrt opened this issue Jan 13, 2025 · 3 comments

Comments

@jwnrt
Copy link
Contributor

jwnrt commented Jan 13, 2025

Description

It would be useful to allow other Bazel modules to depend on OpenTitan in order to access our toolchain, software, tools, etc. for things like downstream demos, operating systems, etc.

There are some issues preventing this:

  1. OpenTitan is not in the central registry.

    • Projects can work around this using git_override, however this can only be used in root modules.
  2. For some reason Bazel only allows include directives in the root MODULE.bazel and not those of dependencies.

    • This is surprising and seems like an arbitrary restriction.
    • We may have to remove our use of include which may complicate our repo.
  3. @engdoreis has found that the .llvm extension from https://github.com/bazel-contrib/toolchains_llvm that we use to get a toolchain for bindgen can only be used from the root module.

    • No idea why. Maybe we can replace this with the lowRISC RISC-V toolchain? We'd need to get an x86_64 libc++ from somewhere still.
  4. @engdoreis also found that we cannot use @// in the MODULE.bazel, it should be @@// or just //. That's an easy fix.

@jwnrt jwnrt added SW:Build System Type:Enhancement Feature requests, enhancements labels Jan 13, 2025
@jwnrt
Copy link
Contributor Author

jwnrt commented Jan 13, 2025

CC @pamaury and @nbdd0121, do you have any thoughts on the include problem? Would it be too messy to inline rust.MODULE.bazel and python.MODULE.bazel into the main MODULE.bazel?

@jwnrt jwnrt mentioned this issue Jan 13, 2025
17 tasks
@pamaury
Copy link
Contributor

pamaury commented Jan 14, 2025

I also do not understand this limitation of include. I think putting everything into one file would be very messy. An idea would be to generate MODULE.bazel from a template where the includes are replaced by textual inclusion, check-in that file. This would make MODULE.bazel very messy but this would not be the main file that people edit?

@jwnrt
Copy link
Contributor Author

jwnrt commented Jan 14, 2025

That could work, but I think the extra step required to generate MODULE.bazel would cancel out the simplification of being able to split out sub-files.

@jwnrt jwnrt removed the Type:Enhancement Feature requests, enhancements label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants