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

Template variables for cxx_genrule do not work with system_cxx_toolchain #720

Open
thoughtpolice opened this issue Jul 14, 2024 · 0 comments

Comments

@thoughtpolice
Copy link
Contributor

thoughtpolice commented Jul 14, 2024

The documentation for cxx_genrule lists a bunch of macros that are available in the context of the command such as $(cxx) or $(cxxflags). These unkeyed TemplatePlaceholderInfo() variables are expected to come from toolchains//:cxx which is a dependency of cxx_genrule. These macros are very useful, obviously, for commands like bindgen that need access to the compiler flags.

However, it doesn't work OOTB with system_cxx_toolchain, because system_cxx_toolchain doesn't call cxx_toolchain_infos which sets up the appropriate TemplatePlaceholderInfo(). After some spelunking I found cxx_toolchain, a very handy rule, that does do that, and is a bit more appropriate for my use case where I download a toolchain and then point something to it.

Currently on Windows I use system_cxx_toolchain with a hack to avoid these template variables in that case, and though I'll probably migrate to cxx_toolchain on all platforms including Windows to mitigate this and make things more consistent, this should still probably be fixed OOTB for users.

@thoughtpolice thoughtpolice changed the title Template variables for cxx_genrule like $(cxxflags) do not work with system_cxx_toolchain Template variables for cxx_genrule do not work with system_cxx_toolchain Jul 14, 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

1 participant