Re: Okay, how much ram does it take to build Rust?

Daniel Engberg <[email protected]>
Newsgroups gmane.os.freebsd.devel.ports
Message-ID <[email protected]>
On 2025-09-11 09:42, Dan Mahoney (Ports) wrote:
> Hey there folks,
>
> I've got poudriere running on a recently-16-ified VM with 8 cores and 48G ram (up from 32), and to eat the dogfood I'm attempting to build all my own packages.
>
> lang/rust is a big one.  It pontificates for about two hours, then dies with:
>
> [ 45% 1690/3710] Building RISCVGenExegesis.inc...
> [ 45% 1691/3710] Building RISCVGenGlobalISel.inc...
> FAILED: [code=262] lib/Target/RISCV/RISCVGenGlobalISel.inc /wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/lib/Target/RISCV/RISCVGenGlobalISel.inc
> cd /wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build && /wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/bin/llvm-tblgen -gen-global-isel -I /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/lib/Target/RISCV -I/wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/include -I/wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/include -I /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/lib/Target -no-warn-on-unused-template-args /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/lib/Target/RISCV/RISCVGISel.td --write-if-changed -o lib/Target/RISCV/RISCVGenGlobalISel.inc -d lib/Target/RISCV/RISCVGenGlobalISel.inc.d
> LLVM ERROR: out of memory
> Allocation failed
> PLEASE submit a bug report tohttps://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
> Stack dump:
> 0. Program arguments: /wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/bin/llvm-tblgen -gen-global-isel -I /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/lib/Target/RISCV -I/wrkdirs/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/include -I/wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/include -I /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/lib/Target -no-warn-on-unused-template-args /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/src/llvm-project/llvm/lib/Target/RISCV/RISCVGISel.td --write-if-changed -o lib/Target/RISCV/RISCVGenGlobalISel.inc -d lib/Target/RISCV/RISCVGenGlobalISel.inc.d
> ninja: build stopped: subcommand failed.
>
> thread 'main' panicked at /wrkdirs/usr/ports/lang/rust/work/rustc-1.89.0-src/vendor/cmake-0.1.54/src/lib.rs:1119:5:
>
> command did not execute successfully, got: exit status: 6
>
> build script failed, must exit now
> stack backtrace:
>     0: __rustc::rust_begin_unwind
>     1: core::panicking::panic_fmt
>     2: cmake::fail
>
> Full logs here:
>
> https://poudriere-src.isc.org/data/freebsd:16:x86:64-pkgbase-default_git/2025-09-11_04h17m42s/logs/rust-1.89.0.log
>
> Is this actually likely an LLVM bug, or is 48G of ram not enough (it barely climbed at all for most of the files).  Note that I'm not doing anything multi-threaded with Poudriere, this is single CPU bound.
>
> -Dan

Hi,

During linking it can use up quite a bit of memory, especially if you 
have multiple jobs running. You will struggle with 12Gb of RAM, 8Gb 
swapand ZFS (ARC) using ports and 3 jobs (-j3) using slow CPU (older i3 
etc). My Ryzen (7000 series) box needs about 40Gb of RAM (including 
tmpfs) alone to build Rust using Poudriere without ARC accounted for and 
that's running -j8. It can be a bit hard to estimate as time for linking 
processes to finish can wary greatly depending on hardware and if those 
accumulate you'll need even more memory because of the slow processingand 
multiple running in parallel. Best regards, Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.