This is an archive of the discontinued LLVM Phabricator instance.

Bump MSVC required version to 19.14
ClosedPublic

Authored by rnk on Dec 2 2020, 3:21 PM.

Details

Summary

LLVM passes overaligned objects by value, which MSVC 19.1 didn't support on
x86_32. MSVC added this support somewhere between 19.1 and 19.14, but godbolt
doesn't have 19.11, 19.12, or 19.13 so I can't test before 19.14:
https://gcc.godbolt.org/z/75YoEz

Even if users are using the Visual Studio 2017 series of Visual C++ toolchains,
they should've already updated to 19.14 or newer at this point, or they
wouldn't be able to build LLVM. This just raises the CMake required minimum
version so the build fails earlier.

Diff Detail

Event Timeline

rnk created this revision.Dec 2 2020, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2020, 3:21 PM
rnk requested review of this revision.Dec 2 2020, 3:21 PM
aganea accepted this revision.Dec 2 2020, 5:16 PM
This revision is now accepted and ready to land.Dec 2 2020, 5:16 PM
jfb accepted this revision.Dec 2 2020, 5:24 PM
jfb added a subscriber: STL_MSFT.

LGTM. Maybe someone like @STL_MSFT can see if MS folks are OK with this change.

No objection here. I'd actually suggest cranking your minimum required version all the way up to VS 2017 15.9, the last update which is in long-term servicing. (While everyone *should* upgrade to VS 2019, upgrading within VS 2017 15.x is even easier, and 15.9 is an old release by now, so it's not asking very much.)

rnk added a comment.Dec 3 2020, 9:59 AM

I'd like to do what Stephan suggests, but I want to minimize the risk of breakage for now. Following our standing policy of supporting compilers no more than three years old, we may want to consider dropping support for the 19.1* series in six months or so.

This revision was landed with ongoing or failed builds.Dec 3 2020, 10:09 AM
This revision was automatically updated to reflect the committed changes.

This change makes it impossible to build clang 12 with clang 11.

Host Clang must have at least -fms-compatibility-version=19.14, your version is 19.11.

This change makes it impossible to build clang 12 with clang 11.

Host Clang must have at least -fms-compatibility-version=19.14, your version is 19.11.

I think that the problem is that you're trying to build from a regular cmd.exe? The code here: https://github.com/llvm/llvm-project/blob/d480f968ad8b56d3ee4a6b6df5532d485b0ad01e/clang/lib/Driver/ToolChains/MSVC.cpp#L1341 is unable to detect your version of MSVC in the PATH, so it just puts version 19.11 arbitrarily.

What value is your %VCToolsVersion% or %VSCMD_VER% ?

Can you try running from a "x64 Native Tools Command Prompt for VS 2019" shell?

Hi. Thanks for a reply.
I don't have any MSVC installed. I grab once include and lib files from MSVC and purged it out.
I'm using clang because it is capable to build everything i need including itself without any MSVC installed only by supplying headers and libraries to it.
That's very strange that ms compatibility is determined by checking external resources.
What one can do to dump ms compatibility version without having MSVC?

In that case you'll need to pass -fmsc-version=... or -fms-compatibility-version=... in the -DCMAKE_CXX_FLAGS and -DCMAKE_C_FLAGS, and put the proper version that corresponds to your MSVC includes/libs. You don't really need to MSVC binaries.

Thank very much. I'll try. Sorry for bother.

Would it be a good idea to bump the default MSVC version that Clang presents itself as to 19.14 at this point, to remedy this situation?

rnk added a subscriber: zequanwu.May 27 2021, 3:01 PM

Would it be a good idea to bump the default MSVC version that Clang presents itself as to 19.14 at this point, to remedy this situation?

Yes, let's do that. Let me delegate that to @zequanwu.

Zeqaun, can you take a look at D38646 and raise our default compatibility version to 19.14 as was done there? You may have to update some test cases.