3 ms·
Use bazel? Individual files won't be faster but it's been a wonder for whole project compilations
by sjakwjsjsisj 5y ago
Use bazel?
Individual files won't be faster but it's been a wonder for whole project compilations
- charcircuit 5y agoThis could be interesting to look into. It looks like there already exists a project that can generate BUILD files for external crates. My 2 main gripes with Bazel was that it was a pain having to rewrite the build system for all of my dependencies and that it's claim of being reproducible is weak in the sense that there are not even warnings when you use resources from the base system (eg. compilers can include files from the base system which may not be the same / exist on another) (this is a problem since I wanted to use a header from the dependency I built with Bazel and not something already on my system)
- sjakwjsjsisj 5y agoYep, agree on all fronts, the last point being especially painful when working on software you distribute to end users whose systems aren't in your control.
- larsrc 5y agoAre you enabling sandboxing? Use `--spawn_strategy=sandboxed`, or better yet `--spawn_strategy=worker,sandboxed --worker_sandboxing`. That should disallow using files from the base system. This does disable multiplex workers,.which can make it more memory intensive. Working on that.
- charcircuit 5y agoYes, I was using their sandbox. They intentionally make their sandbox weak so you can use things like gcc from the system without having to bootstrap them. I don't know exactly what I tried since this was maybe a year and a half ago. I tried asking on their slack, but I think I was told that it was not possible. I don't have the project around anymore to try out your suggestion.
- zuzun 5y agoThis is controlled by their default toolchain that includes /usr/include and such. You can define your own toolchain with different include directories.
- echelon 5y agoDoes anyone have an example of a Rust Bazel build project? Or even better, a massive Rust monorepo orchestrated with Bazel build?
- pjmlp 5y agoNot what you asked for, but maybe still interesting to look into. Android uses Soong for Rust, https://source.android.com/setup/build/rust/building-rust-modules/overview https://source.android.com/setup/build/rust/building-rust-mo... While Fucshia uses GN with Rust, https://fuchsia.dev/fuchsia-src/development/build/concepts/build_system/intro https://fuchsia.dev/fuchsia-src/development/build/concepts/b... https://fuchsia.dev/fuchsia-src/development/languages/rust https://fuchsia.dev/fuchsia-src/development/languages/rust
- echelon 5y agoFantastic resources, thanks!