build: Migrate to "StageX 2.0"#376
Conversation
|
Looks like CI is failing at the "Run command inside Docker container" step: Example of a successful run: https://github.com/zcash/wallet/actions/runs/21872823726/job/63132877649 |
|
Yes currently the binary is seg-faulting because it's not properly statically linked. I'm trying to fix it. |
|
Encountered more issues but we are continuing to work on resolving this. Thanks for the patience, and I'll keep you posted. Are there any big deadlines or blockers if this PR is delayed? |
1121b2f to
16f77f6
Compare
e8ae39f to
0a5f551
Compare
|
There are some issues with building with |
|
It's been mentioned elsenet that |
I can't think of anything in |
I'll definitely pass more info along once I've resolved the datestamp. Everything else (besides datestamp and rage) in the rlibs appears to be rmeta fields, which don't make it into the end binary. |
|
and as a testament to checking all the rlibs before chasing down a single potential issue to its most extreme... I've got three bit-for-bit reproductions, just after changing SOURCE_DATE_EPOCH. I need to do some investigation into caching - I witnessed a 1.8x speedup by removing all caching, so I'll see if I can reapply my fixes on the branch, cleanly, and reproduce any caching mismatches again. |
|
It looks like there's two attempts at caching going on and they appear to be conflicting with each other. One attempt builds the dependencies in a previous stage, while the other mounts a new cache over the copied-over assets, requiring them to be built again. I'd recommend skipping the |
|
The intention of the Docker layering is that updates to the Zallet codebase that don't affect dependencies only require rebuilding the second layer, reusing the binary artifacts from the first Docker layer. If this is not correctly working then yes this should be changed to something that does work. I don't actually know much myself about how |
First, to clarify how Dockerfile layers are cached: Dockerfile layer caching assumes that, given all inputs remain the same, all outputs remain the same. It's similar to a pure function. This means that any input changing at a previous layer, would result in the entire cache being unusable, because we assume that any input changing in a prior step invalidates results of a further step. It is less of a "cache", and more of a "snapshot". This used to be the only way to do caching in Docker, and resulted in patterns used by projects like However, if you change any dependencies, or if you had multiple crates and you changed any of the other crates in your workspace, the layer still becomes invalidated and all of the existing cache is no longer applicable. The For optimizing CI, I would heavily recommend making use of |
|
Sounds good, let's do that then |
|
My latest commit uses the |
|
Modifying a source in a way that doesn't trigger a fetch will take about 1.5 seconds on the fetch step. Every modification that isn't "Docker pure" will result in a full rebuild of the |
- bump pallet-rust, user-protobuf, user-abseil-cpp - add pallet-clang - replace core-user-runtime with core-filesystem - add USER 1000:1000 to runtime stage - add flags for clang and lld to be used - remove ROCKSDB_USE_PKG_CONFIG=0 as it's unneccessary due to flags added
|
Rebased on |
|
Force-pushed to undo the deletion of some comments (which made sense for one of the intermediate states, but does not with the current state of the PR) and fix an indentation bug. |
|
Force-pushed to make the diff a bit smaller. |
| FROM stagex/user-protobuf@sha256:5e67b3d3a7e7e9db9aa8ab516ffa13e54acde5f0b3d4e8638f79880ab16da72c AS protobuf | ||
| FROM stagex/user-abseil-cpp@sha256:3dca99adfda0cb631bd3a948a99c2d5f89fab517bda034ce417f222721115aa2 AS abseil-cpp | ||
| FROM stagex/core-user-runtime@sha256:055ae534e1e01259449fb4e0226f035a7474674c7371a136298e8bdac65d90bb AS user-runtime | ||
| FROM stagex/pallet-rust:1.91.1@sha256:4062550919db682ebaeea07661551b5b89b3921e3f3a2b0bc665ddea7f6af1ca AS pallet-rust |
There was a problem hiding this comment.
Given that StageX only provides images for a small set of specific Rust versions, going forward I intend us to decouple (as much as possible) the Zallet MSRV from these. That means:
- Normal development uses
rustuplike usual with whatever our MSRV is. - The
stagex/pallet-rustversion pinned here in thisDockerfileshould be the most recent stable Rust release provided by StageX. - CI confirms via the
test-docker-container.ymlworkflow that MSRV is not higher than this pinned Rust version.
The StageX tree underwent a major overhaul to switch from being GNU-native to LLVM-native for much better cross compiling support, among many other advantages. It is essentially StageX 2.0, but introducing minor breaking changes. We should have done a better job with release notes but now that we have landed this work (which was ongoing over most of the last year) we are shifting our efforts to: stability, massive compile-time and run-time speed improvements, hardening, timely and largely automated reproductions and updates, better release notes and docs! A lot of people are using stagex fast as it is the only thing that solves the supply chain problem well, but we have some catching up to other distros to do in terms of docs and examples to be sure.
In addition to documentation, our hope is our upcoming tool "sxctl" will be able to automate migration and updates to stagex based containerfiles.
I've done the following to fix your build:
protobufandabseil-cppto latestuser-runtimewhich is deprecated now, and switched tocore-filesystem, then addedUSER 1000:1000as that will likely be removed fromcore-filesystemclangandlldduring compilation, and removed therocksdbenv varROCKSDB_PKG_CONFIG=0as the flags override that env varGoing forward, it should be sufficient to bump these packages to the latest release.
For now some of us just include scripts like https://git.distrust.co/public/airgap/src/branch/main/src/update.py to simplify discovery of the latest set of built-together hashes.
Thanks for being patient with this and don't hesitate to poke me if you have any issues, I'm happy to help unblock you and make the distro work better for you.