-
Notifications
You must be signed in to change notification settings - Fork 115
Building a process binary for two different platforms with the same target triple causes a race condition. #366
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
Comments
It's very hard to understand what
For the record, I used
|
So the current status is that building for different platforms with the same target triple causes races. |
I'm trying to think through whether it is possible to solve this race condition, and if so, how. First off: we only have a race if If
This results in the So at the minimum, we should document that Additionally, there are a couple ways we could prevent this race for
Of course option 3 (document + ignore) exists as well. |
This is effectively what the libtock-c build system does. There the requisite granularity is core type, (i.e. separate builds for cortex-m0, -m3, -m4, -m7, and each flavor of risc-v), Most of the compilation for any app is the libtock library, so the ecosystem sees reasonably appreciable benefit from sharing platform build directories / re-using libtock library objects. Reproducible builds are the other important part of the puzzle there, as it doesn't really matter if parallel build processes compile the same library file for a given platform in a racy way, as they'll both produce the same thing.* I very intentionally set up CI to stress test this—the *Caveated on built object files being written / updated atomically such that another build process wouldn't try to read a partially written file; which compilers seem sensible on in practice] |
Note that in the context of #482, this means passing a different |
Sigh, yep, that's how we end up with this list of "targets" https://github.com/tock/libtock-c/blob/432746cd7df195a6122d0d3f0e88a16720d5376d/Configuration.mk#L80-L94 I (optimistically?) view the spurious builds per-location as a transient hack that can be removed when relocations land. |
ePIC makes everything better for sure. sigh |
This resolves the race condition described in tock#366 for `cargo run` invocations performed by `libtock-rs`'s `Makefile`.
Which directory? |
I don't recall, and I don't have that
If it's worth putting more effort into answering your question, let me know and I will recreate my test setup and give you a confident answer. |
Well is it possible that cargo could build two elfs at once but for different target triples? |
A quick test shows that it is possible to build two ELFs at once if one uses the release profile and one uses the debug profile (whether or not they are different target triples). So far, I haven't been able to get it to build two release ELFs simultaneously, even with different target triples. |
At this point, I believe we've fixed all race conditions that are worth fixing. The remaining race conditions I'm aware of are:
Issues 1 and 2 are pretty much baked into the designs of |
Question: If you try to build process binaries with two different layouts concurrently, does it result in a race condition? I'm primarily concerned with the layout file selection in
libtock_runtime
'sbuild.rs
.If the answer is yes, then we should investigate how to fix the race.
This question becomes more important if we add functionality to
build.rs
to support building apps for multiple slots.The text was updated successfully, but these errors were encountered: