# lang/rust huge disc requirement during build



## YuryG (Apr 12, 2021)

Recently I've got out of space on my /usr/src partition due to building (upgrading) of lang/rust. It occurred that Rust required more than 12 GiB on disc to be built! The next disc-hungry port for me is www/chromium, which required about 10 GiB. When installed and cleaned I get almost all the disc back. Why they are so huge during build? Should someone be warned before such builds?


----------



## SirDice (Apr 12, 2021)

YuryG said:


> Recently I've got out of space on my /usr/src partition due to building (upgrading) of lang/rust.


These two have nothing to do with each other, /usr/src/ contains the FreeBSD source tree and nothing else. Not even intermediate build files from building the OS itself.


YuryG said:


> Should someone be warned before such builds?


These are huge builds, what were you expecting? You'll need a fairly beefy system too, or else it's going to take ages to complete.


----------



## YuryG (Apr 12, 2021)

SirDice said:


> These two have nothing to do with each other, /usr/src/ contains the FreeBSD source tree and nothing else. Not even intermediate build files from building the OS itself.
> 
> These are huge builds, what were you expecting? You'll need a fairly beefy system too, or else it's going to take ages to complete.


Yes, of course, not /usr/src/, but the one where /usr/ports live, my mistake.

I am already used to www/chromium being the huge one and with big download size (about 1GiB), but lang/rust grows tremendously lately for building space (while keeping download size reasonably small). Previous build of lang/rust got less than 10GiB of disc for me definitely. Another long  build devel/llvm surely needs much less space.

Yes, it takes a while of time, but the pain is when you left it building and eventually find the system stale with out of space state, having previoulsy built it nicely.

May be it is some bug to build needless amount of files (if the resulting package is fit enough)?

Surely, it is my problem that I have old partitioning schema and some expectations. “Just asking.” ☺ Thank you for the reply.


----------



## SirDice (Apr 12, 2021)

YuryG said:


> I am already used to www/chromium being the huge one and with big download size (about 1GiB), but lang/rust grows tremendously lately for building space (while keeping download size reasonably small). Previous build of lang/rust got less than 10GiB of disc for me definitely. Another long build devel/llvm surely needs much less space.


You should see the amount of storage space my build server uses.

Normally, when you build ports, everything gets extracted and worked on in a work subdirectory of that port. Not cleaning those out when you're done will use up a lot of storage space. You can set WRKDIRPREFIX to a _scratch_ filesystem to keep your /usr/ports nice and clean.


```
WRKDIRPREFIX      Where to create any temporary files.  Useful if
                       PORTSDIR is read-only (perhaps mounted from a CD-ROM).
```
See ports(7).


----------



## Bubrak (Feb 23, 2022)

Hi.

Just to note - today it required 21 GB, even quite huge growth in less then one year. 
I was also quite surprised when rust started to be built as some new dependency leaf.
Where it can lead in the future? Is it normal to grow 10 GBs each year ?


```
[root@www /data/ports_work/usr/ports/lang/rust]# du -d 1
21457880        ./work
21457884        .
```


----------



## SirDice (Feb 23, 2022)

Rust is a massive build. And there are a lot of ports that have been (re)written in Rust nowadays. Several versions of LLVM and/or GCC will also have a big impact on the storage requirements of your builds.


----------



## Bubrak (Feb 23, 2022)

Thank you SirDice for info. I have LLVM and GCC, but Rust just totally overcame my expectations.  Please how big is your partition for builds now? To get some inspiration. Thank you.


----------



## SirDice (Feb 23, 2022)

Bubrak said:


> Please how big is your partition for builds now?


Hard to tell. I do all my builds on a system that has 16GB of memory and have set poudriere to use tmpfs(5) for the work directories. It has been building pretty much constantly (every time a build run finishes I just start a new one), don't have any problems with storage usage. 


```
# 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"
USE_TMPFS=yes
```

/usr/local/poudriere/data has about 24 GB of packages. But it contains 5 repositories at the moment.


----------



## YuryG (Feb 23, 2022)

Bubrak said:


> Hi.
> 
> Just to note - today it required 21 GB, even quite huge growth in less then one year.
> I was also quite surprised when rust started to be built as some new dependency leaf.
> ...


Yes, it's enormous. It has (almost) all huge dependencies in itself. Previously I had similar problems with www/chromium, but lang/rust outbursts it. Rather discouraging behaviour.


----------



## Selin (Nov 5, 2022)

Hi

tried to update some of my old servers using portmaster and hit the problem - the phpMyAdmin depends on php-gd which depends on gd -> libimagequant -> rust

I had tried several times and each time update failed to build the Rust...

and now I'm here - trying to accept the fact that some 10th dependency requires 20+GB just to be built...

this is old server and it has just 32GB SSD total and only ~7GB are free... so no chances.

the question - if I'll jump from portmaster to pkg - will it solve this issue?

or rust is just a huge something that anyway needs 10x more space than all other ports and the whole system altogether?


----------



## richardtoohey2 (Nov 5, 2022)

Do you need libimagequant? If not build gd with the LIQ option off.

See here:









						What port does rust install?
					

As soon as I saw this recent update wanting to build and install cargo I knew rust wasn't far behind so I stopped the update and changed the config options for gd.  But it seems more and more is being re-built with rust so at some point I'll have a critical dependancy on rust and be forced to do...




					forums.freebsd.org


----------

