-
Notifications
You must be signed in to change notification settings - Fork 113
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
Explore moving the primary build system to Cargo #945
Comments
WDYT @tiziano88 @ipetr0v @anghelcovici (as folk who've fought build systems in the past) |
Thanks for writing this down @daviddrysdale . I think part of the complication here is trying to keep all the examples and the tests working while we switch language underneath them. IIRC:
All in all, I feel more and more strongly that we are not too far off from a pure cargo-buildable binary with no C++ dependencies; if others think that that is at least plausible, I think we should aim for that and cut down the extra complexity of maintaining the dual language split within the same binary. cc @project-oak/core |
I agree that we may need to move towards pure Rust build, because currently it looks like Also a random thought: C++ Nodes (such as a TPU wrapper, i.e. Nodes that will be much easier to implement in C++) probably don't have to be a part of the Oak process. Instead they may be implemented as separate services that will use gRPC to communicate with Oak and attest to it. |
Regarding roughenough, I had a look at it previously. It seems to have a fully functional client, but most of the client functionality is built directly into the binary rather than a reusable lib. So we would need to vendor it into |
Indeed there is not much logic to the roughtime client after all, it's just doing requests and parsing responses, it is only a few dozens lines, it's not even worth vendoring IMO, we should be able to re-implement it ourselves: https://github.com/int08h/roughenough/blob/master/src/bin/roughenough-client.rs . |
all considered, my proposal is:
|
@daviddrysdale sorry I realize I missed one of the points you were trying to make in this issue, that is, IIUC, having cargo invoke bazel as part of the build process (perhaps via a build.rs file) to build any remaining C++ code that we have, and then convince cargo to link that in the final binary. I think this would be a nice solution, but I still think that we are not too far off from being able to migrate (at least in principle) all the remaining C++ code to Rust, at which point I personally don't think there would be much value in keeping around the cargo to bazel part of the workflow just in case we come up with some other C++ dependency (which I don't think it's likely in the short-medium term, but also definitely not impossible). |
Done in #1016. |
We currently have Bazel as our primary build system, which builds a C++
main
, C++ libraries, and includes Rust libraries that are invoked over FFI.We're expecting to move
main
over to Rust under #724, and the obvious initial way to do this is with arust_binary
target in Bazel, keeping the rest of the build system roughly as-is1.However, we could consider moving the primary build system across to be Cargo. That would still require some way of building the C++ code and its dependencies, presumably still Bazel. So:
build.rs
script would invoke Bazel and ensure that a gianteverything-cpp.a
thing got linked in a known place.The following issues should all evaporate if we moved away from Bazel:
(and in fact we could presumably lose
//cargo/
andcargo raze
altogether)1: Aside: it's not that simple.
2: Useful phrase from bazelbuild/rules_rust#78 : "underlinking" seems to mean leaving resolution of undefined symbols until final link of the binary.
The text was updated successfully, but these errors were encountered: