I've got a ~/.cargo/config where I have set up a global target-dir:
[build]
target-dir = "/home/xxx/.cargo/target-main"
Thus in my application there is no default target directory anymore. If I create it, everything works.
If "target" does not exist locally, compilation fails. This is because of create_dir("target/machine") which assumes a local "target" directory exists.
There is "std::fs::create_dir_all" which should fix this.