-
Notifications
You must be signed in to change notification settings - Fork 4k
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
host_platform, platforms and toolchains are incompatible with select #10396
Comments
First, I'd like to apologize that this wasn't responded to sooner: most of us just got back from BazelCon, but we should have been checking new issues, so I am sorry. Secondly, your actual issue:
I think I'm not understanding your system, is there any way you can let me take a look at your BUILD files, or at a simple example of the same setup? |
|
Using |
I'm only registering toolchain targets |
But the thing is that i can see that the select in the compiler_files constraint, first gets set to "platforms", then "host_platform", then the files are resolved |
Many targets, in both the target and host configuration, require a cc toolchain, so it's not surprising that you will see your toolchains loaded in both configurations. I'm not sure the debugging you are seeing is showing what you think you see. Can we take a step back? What is the actual error you are seeing in your builds? |
Sorry for the late reply. Yes it is very likely that i have done something wrong, but I know what fixes the problem :) So this is my host_platform:
And my target --platforms:
So now I expect my host tools to be compiled with GCC, (which they are), and my target compiled with ARM, which it TRIES.. but in the sandbox the GCC files are made avaliable... not the ARM files, so it simply cannot find any ARM resources.. So what fixes the problem: Splitting the filegroup "compiler_files" (see above), into one filegroup per compiler with no SELECT: Now for the big BUT: |
I am off for holidays until after January 2nd. If you can provide a sample
workspace with the WORKSPACE, BUILD, and compiler files, I can take a look
to see what is wrong, but with the data so far I am not sure what the
problem is. I can say that we put in a lot of work to make this case
correct, so that only remote dependencies that are actually needed will be
downloaded.
…On Sat, Dec 21, 2019, 12:40 PM ozio85 ***@***.***> wrote:
Sorry for the late reply. Yes it is very likely that i have done something
wrong, but I know what fixes the problem :)
So this is my host_platform:
platform(
name = "linux_x86_64",
constraint_values = [
***@***.***//Os:linux",
***@***.***//Cpu:x86_64",
***@***.***//Compiler:gcc",
],
)
And my target --platforms:
platform(
name = "linux_arm_gcc",
constraint_values = [
***@***.***//Os:linux",
***@***.***//Cpu:arm",
***@***.***//Compiler:arm_gcc",
],
)
So now I expect my host tools to be compiled with GCC, (which they are),
and my target compiled with ARM, which it TRIES.. but in the sandbox the
GCC files are made avaliable... not the ARM files, so it simply cannot find
any ARM resources..
So what fixes the problem:
Splitting the filegroup "compiler_files" (see above), into one filegroup
per compiler with no SELECT:
Now the compiler files are found and everything works......
Now for the big BUT:
This causes all files to be downloaded for ALL compilers, which adds 20Gb
download for each user.
If I can avoid this, i can skip the select...
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#10396?email_source=notifications&email_token=AACPW73KFDINUQHL2JRQTM3QZZII7A5CNFSM4JZAAUO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHPAL2A#issuecomment-568198632>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPW77HQSSVOB6WS7YWYOTQZZII7ANCNFSM4JZAAUOQ>
.
|
Ok I have made a repro, note that the toolchais are NOT complete: But it is still enough to show the error, the point is that "arm_tool.sh" is missing in the sandbox, even though the correct toolchain was selected:
|
Thank you for the reproduction case. It looks to me like both of your problems stem from the use of the single Problem 1: The arm_tool.sh file is not found.It appears that the evaluation of the select inside the filegroup is selecting the "gcc" case, not the "arm" case. I plan to debug this further to see if this is a bug or some complication with how cc toolchains are resolved, and I will report back. Changing the Problem 1.B: The arm_tool.sh file is not executable.The second error I saw was this:
This indicates that bazel tried to execute Problem 2: Downloading unneeded dependencies.I think this is also due to the problem with the filegroup-and-select. When you use dedicated filegroups, do you still see this problem? |
Okay, investigated the problem with filegroup and select further, this is caused by the lack of toolchain transitions: currently, toolchains are configured in the execution configuration, not the target, and so the select in the filegroup sees the platform as being |
About problem 1b, ye ... i used WSL to test .. so my bad :) still the problem is illustrated. About problem 2: Well, i tried to extend the example to also catch this problem .. but i need a bit more time to reproduce this in a concise way. I tried to add a third toolchain, which is not used, but it it not enough to trigger the any problems (i just need to set tags = ["manual"], to avoid the cc_toolchain from beeing resolved when building "//..."). I need to get back to you next week. |
Tracking issue for implementing toolchain transitions: #10523. |
Seems like the problem was that i had missed setting tags = ["manual"] on all filegroups and cc_toolchains, so with this change i have switched to using the separated filegroups. Still this issue is valid, but of lesser importance. |
I see. Yes, if you don't have the targets tagged as manual, and you are building "//...", they will be configured and dependencies downloaded. Should we provide more documentation of this? |
If it is standard procedure to do this, i think one or two lines would not hurt. Right now its more of a ”recommendation” or best practice that ”//...” should work to build. I think it should be a requirement, but then the tags might need an overhaul. (Currently the only option is to tag it manual, but some items are linked to a platform) I am still missing some of the features the environment_groups provide, to be able to filer groups of items.. but i am hoping that platforms or build_settings have that on the roadmap. We are moving into transitons, but we are still doing some initial development. We will probably put something on Bazel discuss when we are ready. (A totaly self-contained multi-repo structure (including python, compilers and other tools), supporting a multi-variant build using transitions, solved completely with Bazel.) |
Okay, I've filed #10641 to track clarifying the docs. I'm going to close this now, feel free to file a new issue if you run into further confusing or poorly documented areas of toolchains or transitions. |
Description of the problem / feature request:
I have stared to use cc_toolchain resolution via toolchains by enabling:
--incompatible_enable_cc_toolchain_resolution
and instead of cc_toolchain_suite, register all toolchains via "register_toolchain"
The selection works fine, however I want to avoid to download all external compiler dependencies, therefore i would like to use SELECT on the compiler dependencies. This is currently not possible
First the constraint_setting are set to target platform controlled by the "--platforms" argument.
Then the contraint_setting are set to the host platform controlled by the "--host_platform" argument.
THEN the compiler files are resolved, which means they are always resolved to the "host_platform".
This means the target compiler files are never available in the sandboxed actions, instead the host compiler files are available (which they should not).
Feature requests: what underlying problem are you trying to solve with this feature?
toolchains should use config_settings and build_settings to determine toolchains, not constaint_settings and contraint_values.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Use select to resolve compiler files.
What operating system are you running Bazel on?
Windows and Linux
What's the output of
bazel info release
?1.2.0
Have you found anything relevant by searching the web?
No
The text was updated successfully, but these errors were encountered: