From 485bd961e444e2a82acc8a9d4a946b64d2b6eb45 Mon Sep 17 00:00:00 2001 From: Alexey Dubovskoy Date: Mon, 13 Jul 2026 10:25:59 +0100 Subject: [PATCH] fix(build): use thin LTO to cut peak build memory Fat LTO with codegen-units = 1 is the highest-peak-memory codegen configuration available, and applying it across a ~400 crate graph needs a multi-GB heap at link time. On low-memory ARM boards this OOMs, and because cargo install writes its target dir into /tmp -- which Armbian mounts on zram, sized to RAM/2 -- the resulting truncated rlib surfaces as 'failed to load bitcode of module'. Thin LTO keeps most of the optimisation benefit without the fat LTO memory cliff, and dropping codegen-units = 1 restores codegen parallelism. Refs #366 --- Cargo.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7706f0b..89d2080 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,5 +124,6 @@ regex = "1" [profile.release] strip = true -lto = true -codegen-units = 1 +# Fat LTO with codegen-units = 1 needs a multi-GB heap to link this dependency +# graph, which OOMs on low-memory ARM boards. See #366. +lto = "thin"