rules_cc icon indicating copy to clipboard operation
rules_cc copied to clipboard

Fix target naming to follow symbolic macro naming requirements

Open reutermj opened this issue 5 months ago • 3 comments

Any target produced by a symbolic macro must start with the name of the macro. cc_toolchain produces two sets of targets prefixed with _ instead of the name. This change drops the _ prefix from the targets produced by cc_toolchain to enable its use in symbolic macros.

example error:

ERROR: /home/mark/.cache/bazel/_bazel_mark/5979f8eda1b07b2dab85fbe51f06c597/external/toolchains_cc++cxx_toolchains+toolchains_cc_default_toolchain/BUILD:3:18: in cc_toolchain_config rule @@toolchains_cc++cxx_toolchains+toolchains_cc_default_toolchain//:_toolchains_cc_default_toolchain_cc_toolchain_config: Target @@toolchains_cc++cxx_toolchains+toolchains_cc_default_toolchain//:_toolchains_cc_default_toolchain_cc_toolchain_config declared in symbolic macro 'toolchains_cc_default_toolchain' violates macro naming rules and cannot be built. Name must be the same as the macro's name, or the macro's name followed by '_' (recommended), '-', or '.', and a non-empty string.

fix verified with working toolchain: https://github.com/reutermj/toolchains_cc/tree/backup-gcc

reutermj avatar Sep 09 '25 15:09 reutermj