Rust does not build anymore

rust has always been a major PITA to build due to its idiotically high ressource usage (which is considered 'normal' and 'ok' by its devs...), which is also constantly increasing. Currently it piles up ~60GB in tmpfs during build. So, first and foremost you have to add rust to the TMPFS_BLACKLIST in poudriere.conf to prevent it from exhausting all memory during build. Without this I had rust failing (and often causing other fallout due to complete memory exhaustion) even on hosts with 256GB or more of RAM...
I read the Makefile yesterday and it says that it sets the location for temporary compilation files to workdir, away from $TMPDIR. Apparently you are not the first one to have encountered this, but it should no longer apply.

Code:
# rustc stashes intermediary files in TMPDIR (default /tmp) which
# might cause issues for users that for some reason space limit
# their /tmp.  WRKDIR should have plenty of space.
# ?= to allow users to still overwrite it in make.conf.
TMPDIR?=        ${WRKDIR}
 
  • Thanks
Reactions: sko
I read the Makefile yesterday and it says that it sets the location for temporary compilation files to workdir, away from $TMPDIR. Apparently you are not the first one to have encountered this, but it should no longer apply.

Code:
# rustc stashes intermediary files in TMPDIR (default /tmp) which
# might cause issues for users that for some reason space limit
# their /tmp.  WRKDIR should have plenty of space.
# ?= to allow users to still overwrite it in make.conf.
TMPDIR?=        ${WRKDIR}
poudriere also puts the WKRDIR in TMPFS by default:

Code:
# Use tmpfs(5)
# This can be a space-separated list of options:
# wrkdir    - Use tmpfs(5) for port building WRKDIRPREFIX
# data      - Use tmpfs(5) for poudriere cache/temp build data
# localbase - Use tmpfs(5) for LOCALBASE (installing ports for packaging/testing)
# all       - Run the entire build in memory, including builder jails.
# yes       - Enables tmpfs(5) for wrkdir and data
# no        - Disable use of tmpfs(5)
# EXAMPLE: USE_TMPFS="wrkdir data"

So one either has to selectively set 'USE_TMPFS="data"' for rust or simply disable TMPFS entirely for it, which IMHO is the safest solution since rust is hopelessly bloated in every regard; so just keep it as far away from tmpfs as possible...


edit: just realized TMPFS ≠ TMPDIR
 
edit: just realized TMPFS ≠ TMPDIR
So, should I try to add rust to the TMPFS_BLACKLIST in poudriere.conf? Because, last week I tried to build it (with a USB stick as swap) and it was ok (VICTORY!) This morning, with the same configuration, a new failed to reclaim memory after 7 hours, haha.
 
FWIW I just compiled the rust port on 13.5-RELEASE-p6 with no problems.
And… without any changes, the build of lang/rust has succeeded last night.
I guess I need a more powerful machine. However, first, I'll improve my swap and set a proper re-install when FreeBSD 15.0-RELEASE will be available.
 
It seems you're not alone who has problem with the compilation: there's a newer thread also having problems compiling rust.

ssbear You did paste the output where the compilation failed but you omitted the output that shows the exact error it choked on. We see failed command: bootstrap dist --jobs=1 but not why it failed.

When I was helping in the other thread I had two VMs: older 13.2 I upgraded to 13.5p6 and one fresh install (release, not updated). I was able to install rust on release immediately just fine but was failing to do it on that upgraded VM. rust brings its own llvm which had an issue -- it was failing to build test case it does during compilation (certain /usr/include/ structure changed between upgrades, test case was not able to compile due to missing headers).
I wonder what did it fail on in your case.
 
Back
Top