You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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_toolchainJul 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 unkeyedTemplatePlaceholderInfo()
variables are expected to come fromtoolchains//:cxx
which is a dependency ofcxx_genrule
. These macros are very useful, obviously, for commands likebindgen
that need access to the compiler flags.However, it doesn't work OOTB with
system_cxx_toolchain
, becausesystem_cxx_toolchain
doesn't callcxx_toolchain_infos
which sets up the appropriateTemplatePlaceholderInfo()
. After some spelunking I foundcxx_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 tocxx_toolchain
on all platforms including Windows to mitigate this and make things more consistent, this should still probably be fixed OOTB for users.The text was updated successfully, but these errors were encountered: