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

cc_tool builds src for wrong platform #299

Open
anguslees opened this issue Jan 6, 2025 · 3 comments
Open

cc_tool builds src for wrong platform #299

anguslees opened this issue Jan 6, 2025 · 3 comments

Comments

@anguslees
Copy link

anguslees commented Jan 6, 2025

cfg = "exec",

I think cc_tool(src) should be cfg=target, not cfg=exec.

Explanation: The cc_tool rule does not (itself) execute the tool as a build action (no ctx.actions.run). Presumably there will eventually be some other rule that uses the output from cc_tool as an attribute, and (importantly) also invokes the tool. That rule should consume the tool via an attribute with cfg=exec, so the tool transition can evaluate all the constraints correctly for that rule.

@pzembrod
Copy link
Collaborator

I don't think I quite understand the reasoning in the explanation. Why should a cc_tool() not run on the exec platform?

@matts1 fyi

@armandomontanez
Copy link
Collaborator

There were some aspects of the initial design that warranted putting cfg=exec there, but kind of agree with you. We should probably put cfg=exec at the cc_toolchain.tool_map attribute, and remove it from the cc_tool rule.

@matts1
Copy link
Contributor

matts1 commented Jan 13, 2025

tool_map already has a transition to cfg=exec (source).

I think it should be safe to just replace exec with target.

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

4 participants