Bug 1222269

Summary: LLVM run OOM while building typst for armv6/7 with 24G of RAM
Product: [openSUSE] openSUSE Tumbleweed Reporter: Guillaume GARDET <guillaume.gardet>
Component: DevelopmentAssignee: Guillaume GARDET <guillaume.gardet>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Current   
Target Milestone: ---   
Hardware: armv7   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Guillaume GARDET 2024-04-03 09:28:41 UTC
LLVM run OOM while building typst for armv6/7 with 24G of RAM while aarch64 requires 11.8G of RAM

**********
[  173s]    Compiling typst-ide v0.11.0 (/home/abuild/rpmbuild/BUILD/typst-0.11.0/crates/typst-ide)
[  429s]    Compiling typst-fuzz v0.11.0 (/home/abuild/rpmbuild/BUILD/typst-0.11.0/tests/fuzz)
[  658s] LLVM ERROR: out of memory
[  658s] Allocation failed
[  658s] thread 'main' panicked at cargo-auditable/src/rustc_wrapper.rs:101:39:
[  658s] called `Option::unwrap()` on a `None` value
[  658s] note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[  658s] error: could not compile `typst-docs` (bin "typst-docs")
[  658s] warning: build failed, waiting for other jobs to finish...
[  663s] LLVM ERROR: out of memory
[  663s] Allocation failed
[  664s] thread 'main' panicked at cargo-auditable/src/rustc_wrapper.rs:101:39:
[  664s] called `Option::unwrap()` on a `None` value
[  664s] note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[  664s] error: could not compile `typst-fuzz` (bin "compile")
[  694s] LLVM ERROR: out of memory
[  694s] Allocation failed
[  694s] thread 'main' panicked at cargo-auditable/src/rustc_wrapper.rs:101:39:
[  694s] called `Option::unwrap()` on a `None` value
[  694s] note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[  694s] error: could not compile `typst-cli` (bin "typst")
[  694s] error: Bad exit status from /var/tmp/rpm-tmp.R2PFPX (%build)
**********

See: https://build.opensuse.org/package/live_build_log/openSUSE:Factory:ARM/typst/standard/armv7l
Comment 1 Aaron Puchert 2024-05-06 22:46:06 UTC
These are 32-bit architectures, right? Then the issue is probably not that we're running out of physical memory, but that we're running out of virtual memory. There is a limit of a little bit under 4G per process, regardless of the available physical memory.

You could try e.g. building without debug info, or if this is LTO, reduce the number of parallel LTO threads. No idea how one would do that in Rust, but all linkers have options for that: https://clang.llvm.org/docs/ThinLTO.html#controlling-backend-parallelism. Note that the memory consumption of LTO grows roughly linear with the number of threads, see e.g. https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html.