When Cargo builds crates, it creates a temporary directory for compiler output. I can see this if I dump the command line for link.exe invocation:
/DEF:C:\\Users\\DEVINP~1\\AppData\\Local\\Temp\\rustc0fRFJK\\lib.def
In order to get a reproducible build, these files need to be produced in a known directory. This is required because msvc sometimes embeds paths into generated binaries. Those paths can be normalized with the /pathMap
switch, but only if they are known (the above path is a random name in $TEMP).
I've tried using -Csave-temps
and --out-dir
but these don't change the output directory, only copy files from that temporary directory after they are built. What I need is a way to change the intermediate compilation directory to a known value.
Does Cargo currently support this functionality?