Skip to content

toolchains//:cxx_no_default_deps has become mandatory #1306

@cormacrelf

Description

@cormacrelf

You can't uquery anything any more because of this, which is something that I don't think really belongs in the prelude? toolchains//:cxx_no_default_deps is something Meta needs because Meta's :cxx adds default deps.

(This code added 1 April 2026)

# prelude/decls/toolchains_common.bzl:48 (reformatted to fit)

def _cxx_toolchain():
    # `CxxToolchainInfo, CxxPlatformInfo`, but python doesn't require it
    lang = "cxx"

    # Portions of the macro layers use the `default_deps` attribute to set this
    # to the `:cxx_no_default_deps` option. If a targets has within_view checks
    # that don't list `toolchains//:` they will experience an error. We can avoid
    # this by ensuring the `within_deps` checks inside buck see either of the
    # toolchains below as a possible default value, even though one of them is
    # never able to be selected in this expression.
    return _toolchain(lang, [], default = select({
        "DEFAULT": "toolchains//:" + lang,
        "config//:none": "toolchains//:cxx_no_default_deps",
    }))
buck2 uquery 'deps(//mymodule:main, 1)'
Starting new buck2 daemon...
Connected to new buck2 daemon.
Error evaluating expression:
    deps(//mymodule:main, 1)
    ^----------------------^


Caused by:
    0: Error traversing children of root//mymodule:main
    1: Unknown target `cxx_no_default_deps` from package `toolchains//`.
       Did you mean one of the 41 targets in toolchains//:BUCK?
       Maybe you meant one of these similar targets?
         toolchains//:cxx

       Available targets (showing 25 of 41):
         toolchains//:android
         toolchains//:android-hack
         toolchains//:android_sdk_tools

Workaround

system_demo_toolchains() # or whatever
toolchain_alias(name = "cxx_no_default_deps", actual = ":cxx")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions