1

Is it possible to compile rust code without a tmp dir?

i.e.

rustc -C opt-level=3 -o "$DEST" "$@"

i'm getting the following error:

Compiling failed with exitcode 1, compiler output:
error: couldn't create a temp dir: No such file or directory (os error 2) at path "/tmp/rustcbQ2www"

error: aborting due to previous error

The reason tmp directory isn't available is this is adding rust support for DomJudge, and they run contestants codes in a chroot without tmp, or with potentially a different tmp folder name.

failing that, is there a way to change the tmp dir that rustc uses? e.g. an environment variable e.g. >>TMPDIR=/my_tmp_tmp

Rusty Rob
  • 16,489
  • 8
  • 100
  • 116
  • 1
    check this [comment on github](https://github.com/rust-lang/cargo/issues/4350#issuecomment-340215811) : setting `$TMPDIR` should do the trick – LeGEC Sep 01 '22 at 05:31
  • cool, seems to work, now just need to find a directory i have permission to use. I wonder if i can just set $TMPDIR to . – Rusty Rob Sep 01 '22 at 05:47
  • 2
    Maybe just create one? `mkdir tmp; export TMPDIR=$PWD/tmp` – Sven Marnach Sep 01 '22 at 06:17

1 Answers1

0

You can see Adding a new language which goes into the question explicitly: set CREATE_WRITABLE_TEMP_DIR in the judgehost config.