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

[Query] Is it possible to use a wrapper for the compiler executables #178

Closed
AnithaSyed opened this issue Sep 11, 2024 · 1 comment
Closed

Comments

@AnithaSyed
Copy link

We are using a internal wrapper tool in the make for the gcc compiler.
In bazel since we need to use the toolchain, is there a way to run this wrapper in the toolchain.
EG:- The default gcc command is as /usr/bin/gcc <args for compiler> (Thnx to toolchain I can directly use the arch we need)
Need to run a <wrapper> <args_for_wrapper> /usr/bin/gcc <args for compiler>

Please help on a approach to achieve this using the hermatic toolchain.

@github-actions github-actions bot added the untriaged Requires traige label Sep 11, 2024
@f0rmiga
Copy link
Owner

f0rmiga commented Sep 19, 2024

Are you the wrapper author? We already have a wrapper here: https://github.com/f0rmiga/gcc-toolchain/blob/36e3e1f430871b539ce9261f53491564aa91c170/toolchain/wrapper.sh.tpl.

It gets rendered here:

rctx.template(
wrapped_tool_path,
rctx.attr._wrapper_sh_template,
substitutions = {
"__PATH__": path_env,
"__binary__": tool_path,
},
executable = True,
)
.

This means you have to patch gcc_toolchain to be able to inject a custom wrapper here: https://github.com/f0rmiga/gcc-toolchain/blob/36e3e1f430871b539ce9261f53491564aa91c170/toolchain/defs.bzl#L161C1-L161C14.

If you come up with a solution that can be upstreamed, I'm happy to review a PR.

Feel free to reopen this issue if my suggestion doesn't work.

@f0rmiga f0rmiga closed this as completed Sep 19, 2024
@f0rmiga f0rmiga removed the untriaged Requires traige label Sep 19, 2024
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

No branches or pull requests

2 participants