| layout | single | ||
|---|---|---|---|
| title | Create a Local E4S Binary Cache | ||
| permalink | /create-local-e4s-binary-cache/ | ||
| classes | wide | ||
| sidebar |
|
||
| description | Step-by-step guide to build E4S packages with Spack and publish binaries to your own build cache mirror. |
{% include e4s-page-actions.html %}
This page describes how to create a local, user-defined binary cache for E4S-based builds. The workflow lets you define a package set in a Spack environment, build it, and publish signed binaries to your own mirror location for reuse by your team or site.
-
Install Spack and initialize your shell.
git clone https://github.com/spack/spack.git . spack/share/spack/setup-env.sh spack -V -
Discover compilers on your system.
spack compiler find spack compilers
-
Decide where your cache will live (filesystem path or object storage URL). Examples:
- Local/shared filesystem:
file:///sw/spack/mirror/e4s-local - S3-style endpoint:
s3://my-e4s-cache
- Local/shared filesystem:
-
Create or obtain a GPG key used to sign your binaries.
spack gpg create "E4S Local Cache" "cache@example.org" spack gpg list
Create a dedicated environment and list the products you want to provide from your local cache.
mkdir e4s-local-cache-env && cd e4s-local-cache-env
spack env activate -d .
cat > spack.yaml <<'YAML'
spack:
specs:
- hypre +mpi
- petsc +mpi
- kokkos +openmp
concretizer:
unify: true
view: false
YAMLReplace specs/variants/compilers with the exact E4S product selection needed at your site.
Concretize your environment and build all packages.
spack concretize -f
spack installValidate what is now installed:
spack find -vlAdd your destination mirror and initialize indices.
export LOCAL_E4S_MIRROR="file:///sw/spack/mirror/e4s-local" # change to your location
spack mirror add --scope=user e4s-local "${LOCAL_E4S_MIRROR}"
spack mirror listPublish binaries from your environment to your configured mirror.
# Push all concretized specs from the active environment
spack buildcache push --update-index e4s-local $(spack find --format '/{hash}')If you want to push a subset, provide selected hashes or specs instead of all installed hashes.
On another system or user environment, configure your mirror and trust signing keys:
spack mirror add --scope=user e4s-local "${LOCAL_E4S_MIRROR}"
spack buildcache keys --install --trustThen install with cache preference:
spack install -b auto hypre +mpi
spack install -b only petsc +mpi-b autoprefers binaries and falls back to source.-b onlyrequires binaries and fails if unavailable.
For each new E4S-aligned stack update:
- Update
spack.yamlspecs/versions/variants. - Re-run
spack concretize -fandspack install. - Re-run
spack buildcache push --update-index ....
This incremental workflow lets you maintain a local cache-backed container or software stack tuned to your site needs.
- Missing binaries for a spec: ABI tuple (OS/arch/compiler/SDK) differs from the build system.
- Signature verification errors: consumer does not trust the producer GPG key.
- Unexpected source builds: use
-b onlyto enforce binary-only installs for validation.
- Define your E4S package set in a Spack environment.
- Build once, then publish with
spack buildcache push. - Reuse those binaries from your own mirror with
-b autoor-b onlypolicies.