From 0d173c57e5c63d68e87c8586c998e4b955631176 Mon Sep 17 00:00:00 2001 From: spital <11034264+spital@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:31:18 +0200 Subject: [PATCH 1/2] Fix generic aarch64 Linux builds Keep the default aarch64-unknown-linux-gnu build portable by removing the hardcoded neoverse-512tvb Rust target CPU. Gate the matching rpmalloc C compiler flag behind LORE_AARCH64_NEOVERSE_512TVB so tuned release jobs can opt in explicitly. Update Docker docs now linux/arm64 builds no longer need the amd64 workaround. Test Plan: - cargo fmt --all --check - git diff --check - env -u LORE_AARCH64_NEOVERSE_512TVB cargo build - env -u LORE_AARCH64_NEOVERSE_512TVB cargo build --release - Ran debug and release --version checks for lore, loreserver, and lore_chaos_client - Ran release create/commit/push/clone/branch/merge/sync smoke test - Verified LORE_AARCH64_NEOVERSE_512TVB=1 passes -mcpu=neoverse-512tvb to cc in an isolated target dir Signed-off-by: spital <11034264+spital@users.noreply.github.com> --- .cargo/config.toml | 6 ++++-- docs/how-to/deploy-local-lore-server.md | 7 ++----- lore-base/build.rs | 12 +++++++++++- lore-server/DOCKER.md | 4 +--- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index ed2158e4..123a6ca2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -97,12 +97,14 @@ rustflags = [ # The rust flags for this would be ["-C", "linker-flavor=lld-link"] [target.aarch64-unknown-linux-gnu] -# Target Graviton3+ +# Keep the default aarch64 Linux build portable. Release jobs that produce a +# Neoverse 512-bit vector/SVE artifact can opt in by setting a full +# CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS replacement that includes +# target-cpu=neoverse-512tvb, plus LORE_AARCH64_NEOVERSE_512TVB=1 for C sources. rustflags = [ "--cfg", "tokio_unstable", "-C", "force-unwind-tables=yes", "-C", "force-frame-pointers=yes", - "-C", "target-cpu=neoverse-512tvb", # Leave debug symbols in the binary for now, we want these in place for the server binary, but still split them via # package-cli.sh for CLI binaries. "-C", "split-debuginfo=off", diff --git a/docs/how-to/deploy-local-lore-server.md b/docs/how-to/deploy-local-lore-server.md index a389639a..3765967b 100644 --- a/docs/how-to/deploy-local-lore-server.md +++ b/docs/how-to/deploy-local-lore-server.md @@ -15,7 +15,7 @@ In this guide, you'll deploy local Lore Servers — with durable storage and a c The binary and Docker paths are mutually exclusive, and each is complete on its own — follow one top to bottom. - **[Run from the binary](#run-from-the-binary):** Fewer moving parts and native performance. Pick this to run `loreserver` directly on the host. -- **[Run with Docker](#run-with-docker):** An isolated container. Pick this if you'd rather not put a binary on the host — but note the `linux/amd64` emulation caveat on Apple Silicon in the build step. +- **[Run with Docker](#run-with-docker):** An isolated container. Pick this if you'd rather not put a binary on the host. ## Run from the binary @@ -196,12 +196,9 @@ The binary and Docker paths are mutually exclusive, and each is complete on its This needs Docker (and WSL2 on Windows) and the Lore repository cloned locally. Building the image compiles the server, so it needs several GB of free RAM. From the repository root: ```bash - docker build --platform linux/amd64 -f lore-server/Dockerfile -t lore-server . + docker build -f lore-server/Dockerfile -t lore-server . ``` - > [!NOTE] - > On Apple Silicon or Windows (both arm64 and amd64), build and run with `--platform linux/amd64` as shown. The `linux/arm64` server image targets AWS Graviton3 (SVE), an instruction set those CPUs lack. - 2. **Run it with default settings.** Map both the TCP and UDP sides of port `41337` and the HTTP port `41339`: diff --git a/lore-base/build.rs b/lore-base/build.rs index a3d087ee..1240bb4e 100644 --- a/lore-base/build.rs +++ b/lore-base/build.rs @@ -5,6 +5,8 @@ use std::path::Path; include!("../build-helper.rs"); +const AARCH64_NEOVERSE_512TVB_ENV: &str = "LORE_AARCH64_NEOVERSE_512TVB"; + fn main() -> Result<(), Box> { // Populate environment with build details vergen::Emitter::default() @@ -25,7 +27,9 @@ fn main() -> Result<(), Box> { .opt_level(3) .includes(Some(native_dir.join("thirdparty"))); - if platform == "linux" && arch == "aarch64" { + println!("cargo:rerun-if-env-changed={}", AARCH64_NEOVERSE_512TVB_ENV); + + if platform == "linux" && arch == "aarch64" && env_flag_enabled(AARCH64_NEOVERSE_512TVB_ENV) { cc_builder.flag("-mcpu=neoverse-512tvb"); } @@ -48,3 +52,9 @@ fn main() -> Result<(), Box> { Ok(()) } + +fn env_flag_enabled(name: &str) -> bool { + env::var(name) + .map(|value| value == "1" || value.eq_ignore_ascii_case("true")) + .unwrap_or(false) +} diff --git a/lore-server/DOCKER.md b/lore-server/DOCKER.md index 688565dd..75ae212d 100644 --- a/lore-server/DOCKER.md +++ b/lore-server/DOCKER.md @@ -6,15 +6,13 @@ telemetry integration, or replication is configured. ## Prerequisites - Docker with BuildKit support -- On Apple Silicon (M-series Macs), builds must target `linux/amd64` due to Graviton-specific - compiler flags in `.cargo/config.toml` for `aarch64-unknown-linux-gnu` ## Building From the repository root: ```sh -docker build --platform linux/amd64 -f lore-server/Dockerfile -t loreserver . +docker build -f lore-server/Dockerfile -t loreserver . ``` The build compiles the `loreserver` binary and generates self-signed TLS certificates for QUIC From 89c930a87e95a24fc70f5e611e5104d2b3c6ce0b Mon Sep 17 00:00:00 2001 From: spital <11034264+spital@users.noreply.github.com> Date: Mon, 6 Jul 2026 22:06:34 +0200 Subject: [PATCH 2/2] Fix cargo clippy and nightly fmt Signed-off-by: spital <11034264+spital@users.noreply.github.com> --- lore-base/build.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lore-base/build.rs b/lore-base/build.rs index 1240bb4e..a0b69282 100644 --- a/lore-base/build.rs +++ b/lore-base/build.rs @@ -27,7 +27,7 @@ fn main() -> Result<(), Box> { .opt_level(3) .includes(Some(native_dir.join("thirdparty"))); - println!("cargo:rerun-if-env-changed={}", AARCH64_NEOVERSE_512TVB_ENV); + println!("cargo:rerun-if-env-changed={AARCH64_NEOVERSE_512TVB_ENV}"); if platform == "linux" && arch == "aarch64" && env_flag_enabled(AARCH64_NEOVERSE_512TVB_ENV) { cc_builder.flag("-mcpu=neoverse-512tvb"); @@ -54,7 +54,5 @@ fn main() -> Result<(), Box> { } fn env_flag_enabled(name: &str) -> bool { - env::var(name) - .map(|value| value == "1" || value.eq_ignore_ascii_case("true")) - .unwrap_or(false) + env::var(name).is_ok_and(|value| value == "1" || value.eq_ignore_ascii_case("true")) }