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

toolchain docs: toolchain_type attributes should use absolute label #6829

Closed
laszlocsomor opened this issue Dec 3, 2018 · 5 comments
Closed
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug

Comments

@laszlocsomor
Copy link
Contributor

Description of the problem / feature request:

The toolchain docs give an example where the toolchain rule references the toolchain_type by relative label:

toolchain(
    name = "barc_linux_toolchain",
    exec_compatible_with = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:x86_64",
    ],
    target_compatible_with = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:x86_64",
    ],
    toolchain = ":barc_linux",
    toolchain_type = ":toolchain_type",
)

https://docs.bazel.build/versions/master/toolchains.html

This is wrong -- even though it's syntactically correct, toolchain resolution will not work if this rule is ever used from an external repository.

Instead, the toolchain_type should always reference absolute labels, even if the target is in the same package:

toolchain(
   ...
   toolchain_type = "@repo_name//path/to/package:toolchain_type",
)

Have you found anything relevant by searching the web?

Related bug: #6828

laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue Dec 3, 2018
@iirina iirina added untriaged team-Bazel General Bazel product/strategy issues labels Dec 4, 2018
@mfarrugi
Copy link

mfarrugi commented Feb 7, 2019

This is super difficult to debug, would love to see this immediately error out.

@dkelmer
Copy link
Contributor

dkelmer commented Apr 1, 2019

/cc @dkelmer

@laszlocsomor laszlocsomor added team-Configurability platforms, toolchains, cquery, select(), config transitions and removed team-Bazel General Bazel product/strategy issues labels Apr 2, 2019
@katre
Copy link
Member

katre commented May 11, 2020

This is a special case of #11128.

@sventiffe sventiffe added P3 We're not considering working on this, but happy to review a PR. (No assignee) type: bug labels Nov 10, 2020
@sventiffe
Copy link
Contributor

@laszlocsomor @juliexxia this one hasn't been updated since a while (the referenced issue mentioned on May 11 is still open though). Is this issue still relevant?

@laszlocsomor
Copy link
Contributor Author

laszlocsomor commented Nov 11, 2020

@sventiffe Thanks for asking!

It seems to work now. Here's a complete example built on top of the tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug
Projects
None yet
Development

No branches or pull requests

8 participants
@katre @iirina @mfarrugi @gregestren @dkelmer @laszlocsomor @sventiffe and others