2

Most resources online assume that licensing is a non-issue for compiling CPython extension modules for Windows, because they recommend installing Visual Studio Community Edition for free. However, that does not work in an enterprise setting where the Community Edition license is invalid.

It's unclear whether the MSC compiler falls exclusively under Visual Studio licensing now. It appears to have a complicated history of distribution with and/or apart from Visual Studio as noted in this answer. Older versions have been distributed under other licensing terms, but the one needed for the latest version of Python 3.x (MSC v.1900) does not appear to have ever been named explicitly in any license agreements.

It's not clear what license(s) apply to MSC v.1900 due to vague scope. It was distributed apart from Visual Studio with the Microsoft Visual C++ 2015 Build Tools (official announcement), with unclear licensing. Then in this community post, a member of Microsoft support identified the "Microsoft Visual C++ Build Tools" license as the most applicable, which does not specify any restrictions for commercial use. Later, in the comments for the official announcement, Andrew Pardoe identified the "Supplement for Microsoft Visual Studio 2017" license as the most applicable for the successor to that package, the Visual Studio 2017 Build Tools. The download link for the original Microsoft Visual C++ 2015 Build Tools appears to have been removed from the official announcement.

Is there any way to compile an extension module for the latest official Windows builds of CPython (3.5 - 3.7) without a Visual Studio license?

lehiester
  • 836
  • 2
  • 7
  • 17
  • Windows SDK should always ship with latest C++ compiler, https://dev.eiffel.com/Installing_Microsoft_C_compiler_(Visual_Studio_2010_and_older,_or_Windows_SDK_7.1_and_older) Consider such SDK is widely used, its licensing terms (check with your lawyer) should not require VS purchase. – Lex Li Dec 31 '18 at 03:54
  • The Windows 7.1 SDK appears to have been the last version to include MSC, but that was MSC v.1500, which will not work for the latest versions of Python. I could not find the MSC compiler after installing the Windows 10 SDK--a recursive search for `cl.exe` returned nothing. – lehiester Jan 02 '19 at 14:10
  • 1
    Visual Studio Express 2017 for Windows Desktop might be your last option. Microsoft discontinued Express edition so there would be no 2019 release. So very likely you need to buy VS Pro for your firm if you do want to compile your own Python binaries with VC++. Have you tried other C++ compilers? It would be strange if they only support VC++. – Lex Li Jan 02 '19 at 14:55
  • Using another compiler is currently the best workaround I know, but that means that the official Windows builds of CPython can no longer be safely used due to potential binary incompatibility with the compiled extension DLLs. Then compiling CPython from source and using your own build is necessary, which is a bit cumbersome on Windows (given that it doesn't even ship with a C compiler). – lehiester Jan 02 '19 at 15:36
  • Using the same compiler is an easy way to ensure binary compatibility, but if it's possible to configure another compiler to generate DLLs that are guaranteed to be binary-compatible with executables compiled by MSC v.1900, that would be another option that would satisfy the original question. I just have no idea if that's possible. – lehiester Jan 02 '19 at 15:47
  • I checked out Visual Studio Express 2017 for Windows Desktop, but the same issues about vague licensing apply. Any official statements about whether Visual Studio Express can be used for commercial purposes without a Visual Studio license appear to have been removed (like the one linked in [this answer](https://stackoverflow.com/a/1420723/8626917)), and they appear to predate the 2017 version. It's unclear whether the 2017 version was released under the same terms. – lehiester Jan 02 '19 at 21:57
  • 1
    Its installer should come with the actual licensing terms. Check that out on a spare machine. – Lex Li Jan 02 '19 at 23:13
  • 1
    This question is too broad; it asks us to answer multiple issues. Moreover, Stack Overflow is not the place to ask licensing questions, we really are not positioned to answer those (there are no lawyers here) nor should you rely on advice on licensing from strangers, and those questions are simply not practical programming problems. – Martijn Pieters Jan 04 '19 at 11:22
  • Edited to remove multiple questions. This has been asked several times on "more appropriate" sites such as Microsoft community posts and has never been answered. Also, members of the Visual C++ team appear to have watched `visual-c++` questions on Stack Overflow in the past, and I was hoping someone could provide a reference to official information that would answer the question. I would call this a practical programming problem unless you would separate "programming" and "programming toolchain" problems--I'm trying to compile code with missing dependencies, and it's unclear how to resolve. – lehiester Jan 04 '19 at 13:58
  • Confirmed: Visual Studio 2017 Express does indeed have a [different license](https://visualstudio.microsoft.com/license-terms/mlt080317/) and contains a compatible copy of MSC v19. I'm not a lawyer, but the Express license doesn't specify any restrictions for commercial use. [Lex Li](https://stackoverflow.com/users/11182/lex-li), if the question is reopened and you post an answer, I'll mark it as accepted. – lehiester Jan 04 '19 at 15:01

0 Answers0