cargo: Use the right LLVM tools and arguments for MSVC cross-compilation #160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xbuild
uses the headers fromxwin
to support cross-compiling, but doesn't fully replicate the other setup steps that it proposes to provide a valid and working cross-compilation setup to MSVC. We need to make the following changes:clang-cl
must be used (aclang
driver withcl.exe
interface), as all native projects will callCC
/CXX
with flags that are only compatible withcl.exe
;-I
does not seem to set up the system headers correctly, for this-imsvc
should be used;Remove
-Clink-arg=-fuse-ld=lld-link
because we have already selected a linker for Rust with theLINKER
env var (see warning below). We might instead want to set it inC(XX)FLAGS
so that when a native crate usesCC
/CXX
to link libraries, it can uselld-link
instead of (probably, likecargo
/rustc
whenLINKER
is unsed) usinglink.exe
by default;Unset forced static CRT and
stdlib=libc++
selection, as these don't appear to ever be needed, and cause some builds to fail (when crates are changing these config options themselves?):