crates-build-env icon indicating copy to clipboard operation
crates-build-env copied to clipboard

Put `cl.exe` and `link.exe` on `PATH` on Windows?

Open ecstatic-morse opened this issue 6 years ago • 2 comments

The vast majority of crates use the cc crate for building native libraries. However, a few want the compiler and/or linker on the PATH (see https://github.com/blt/mond). This seems pretty standard coming from the UNIX world, but the normal workflow on Windows seems to be sourcing a vcvars.bat file before you build something. I'm not sure if this should be the crate's responsibility or ours. This is complicated by the fact that powershell doesn't have a source equivalent, so one has to do a contrived workaround to permanently save the configuration in vcvars.bat.

ecstatic-morse avatar Jul 24 '19 17:07 ecstatic-morse

The github repo timvisee.cant-touch-this is a good test case for this. It uses the cmake crate to build a dependency and fails with:

couldn't determine visual studio generator
if VisualStudio is installed, however, consider running the appropriate vcvars script before building this crate

ecstatic-morse avatar Jul 30 '19 19:07 ecstatic-morse

Note that with VS 2019 you could also try to use Developer PowerShell although it seems that's only available for x86 toolset.

danilaml avatar Sep 19 '19 23:09 danilaml