[PATCH] D92705: [llvm] Update WinMsvc.cmake's fms-compatability to match llvm's prereqs

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 15:28:09 PST 2020


aganea added a comment.

In D92705#2437806 <https://reviews.llvm.org/D92705#2437806>, @rnk wrote:

> We should raise the default _MSC_VER, but IMO that's separable, and I wouldn't rely on it. For cross-compilation, I would recommend setting an explicit version. Otherwise, the very host-specific auto-detection logic could run, and it might produce strange results on a Linux system.

Shouldn't we bypass the MSVC toolchain auto-detection on Linux? What is the recommended way to cross-compile Windows binaries on Linux? We would still need a copy of the VC build tools & Win SDK to build, right? (at least for the includes and the libs)
>From Windows, I've tried:

  > pscp -r "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333" aganea at LINUX-BOX:/mnt/vs2019/
  > ssh LINUX-BOX
  ...
  $ clang-cl /c a.cpp /vctoolsdir"/mnt/vs2019/"

But that still reports `-fms-compatibility-version=19.11` because the auto-detection code is skipped on non-Windows: https://github.com/llvm/llvm-project/blob/93671fffb5ef37060da54199cb9e009188f63a0e/clang/lib/Driver/ToolChains/MSVC.cpp#L1222
I suppose on Linux we could manually extract the `VS_VERSION_INFO` from the EXE.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92705/new/

https://reviews.llvm.org/D92705



More information about the llvm-commits mailing list