Closed MarcoBrieden closed 1 year ago
I don't personally use Windows, so help appreciated.
The zigcc-x86_64-unknown-linux-gnu.bat that is failing contains this:
C:\Users\Marco Brieden\.cargo\bin\cargo-zigbuild.exe zig cc -- -target x86_64-linux-gnu -g -Wl,--version-script=C:\Users\Marco Brieden\AppData\Local\cargo-zigbuild\0.16.3\fcntl.map -include C:\Users\Marco Brieden\AppData\Local\cargo-zigbuild\0.16.3\fcntl.h %*
Surrounding all paths with spaces might fix it:
"C:\Users\Marco Brieden\.cargo\bin\cargo-zigbuild.exe" zig cc -- -target x86_64-linux-gnu -g -Wl,--version-script="C:\Users\Marco Brieden\AppData\Local\cargo-zigbuild\0.16.3\fcntl.map" -include "C:\Users\Marco Brieden\AppData\Local\cargo-zigbuild\0.16.3\fcntl.h" %*
I tried editing it, but it gets newly generated every run. Write protecting it causes zigbuild to complain and error out.
The same folder has two more files that have the same issue: "zigcxx-x86_64-unknown-linux-gnu.bat" and "zigranlib.bat".
You can change it here https://github.com/rust-cross/cargo-zigbuild/blob/fb64c6578cd5e94be74d654dc272b8af539ea414/src/zig.rs#L868-L874
And run cargo run zigbuild
instead of cargo zigbuild
to test it.
I think it fails to execute the .bat file in the first place, because of the path. Any idea where that happens?
I think it's https://github.com/rust-lang/rust/issues/29494, unfortunate it's out of our control because we didn't use cmd /c
, something else did.
That bug has been fixed a year ago though, right?
Are you saying the batch file isn't executed from within cargo-zigbuild? Where is it executed from then?
That bug has been fixed a year ago though, right?
They just added a new API which needs to be adopted.
Are you saying the batch file isn't executed from within cargo-zigbuild? Where is it executed from then?
Probably cargo
or cc-rs.
Thanks for finding this!
I think you can workaround it by setting the CARGO_ZIGBUILD_CACHE_DIR
env var to a directory that doesn't contain whitespace.
That worked, thank you very much messense!
My Windows username contains a space, resulting in this profile directory: "C:\Users\Marco Brieden\".
Trying to compile my code results in this error: