Skip to content

Replace wrapper shell scripts with templates - #26

Merged
aredman-agtonomy merged 5 commits into
masterfrom
andrew-templates
Sep 15, 2026
Merged

aredman-agtonomy merged 5 commits into
masterfrom
andrew-templates

Conversation

@aredman-agtonomy

@aredman-agtonomy aredman-agtonomy commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, I'll fix that, also it has been addressed upstream: bazel-contrib/rules_cuda#345

@aredman-agtonomy
aredman-agtonomy merged commit 6c395bb into master Sep 15, 2026
7 checks passed
@aredman-agtonomy
aredman-agtonomy deleted the andrew-templates branch November 11, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants