Open spastorino opened 5 years ago
Hm, so it seems like we do need a temporary directory for these files. If we can't place them in /tmp
or it's equivalent, then they'll probably end up going into the current directory of the compiler, which seems somewhat bad as well.
Do we know what other compilers do here? Presumably, gcc/clang etc all need to write out version scripts and such too?
O_TMPFILE descriptors could be an option, they never pollute the directory tree unless they get linked into it.
That said I would also like them to go into a separate path designated for temporary files. My project folders are under btrfs and get snapshotted via cron jobs. It is preferable if tempfiles don't make it into the snapshots.
I believe we can't use O_TMPFILE and such as we usually need to pass paths to linkers and such that don't accept file descriptors as inputs.
You can pass them as /proc/<pid>/fd/<n>
, with pid either being the parent process or the child if the fd hasn't been closed on exec.
Unfortunately, that's not supported on all platforms I believe, though I could well be wrong. It's also likely to cause problem when trying to debug what went wrong since all of the files are by definition gone :)
Hit this as well. I think any build outputs (including temporary ones) should go on the same filesystem as the final outputs, since we can expect that to be large enough. So a good strategy is to make a subdirectory under the out dir (or path of one of the outputs).
Was surprised to get the following no space left error ...
This happens because rustc_driver is placing a lot of huge places on
/tmp
and tmp on my machine is of typetmpfs
which is stored usually in RAM or swap and it's by default half of the RAM, so 4GB in my old machine.The following are the files created ...
I think that the compilation process shouldn't place this kind of files there.
For more information, read the Zulip discussion https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/no.20space.20left.20on.20device.20(tmpfs).20when.20compiling.20rustc