Repository navigation
Replace wrapper shell scripts with templates - #26
Merged
Merged
Conversation
The original goal was to avoid the glob expansion discovery of the full path to toolchain sysroot and similar files by using bazel templates to write those paths into the wrapper scripts dynamically, but that got a little bit complicated because the templates are provided in this repo while each toolchain was its own repo, so more templates were required.
This avoids a layer of template redirection by co-locating the template files and the toolchain sources in the same top level bazel repository, whereas the http_archive method creates a repo for the tar and we have to create another one for the templated wrappers.
gartnera
reviewed
Sep 15, 2026
Member
There was a problem hiding this comment.
the old toolchain/ubuntu-22.04-native/linux_x86_64/x86_64-linux-gnu-gcc had export PATH="/bin:/usr/bin:$PATH", added deliberately in 5dc1fab ("Add /bin and /usr/bin to x86_64 gcc's PATH (#17)… to support nvcc on x86_64"). The two aarch64 wrappers only ever had /bin, so unifying them onto one template silently reverted #17.
Contributor
Author
There was a problem hiding this comment.
Ah right, I'll fix that, also it has been addressed upstream: bazel-contrib/rules_cuda#345
gartnera
approved these changes
Sep 15, 2026
gartnera
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The goal here is to avoid dependency on the repo names in shell wrappers,
because bazel 8+ manes them unpredictable and finding them with shell
globs isn't ideal. I thought templates would be the correct way to solve this,
but it turned out to require extra steps and more templates because the
toolchain tars are in a different repo (created by http_archive) from the
wrapper scripts, requiring more bazel repo name resolution. To reduce that
complexity replace the http_archive repos with ctx.download in the same
repo as the wrapper scripts, which allows relative paths and bazel labels
for everything within a given toolchain.