Re: MSVC 2017+ Toolset Support
Joseph Brill <[email protected]> Fri, 14 Aug 2020 10:40:44 -0400
| Newsgroups | gmane.comp.programming.tools.scons.devel |
|---|---|
| Message-ID | <CAJLrGP3DJ=fDRrw3ae5TrreMi2ggNbpD3EvYugKc_yorXfgwvA@mail.gmail.com> |
--===============6232700144213001496== Content-Type: multipart/alternative; boundary="0000000000006a578c05acd7689a" --0000000000006a578c05acd7689a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Aug 11, 2020 at 10:52 PM Jason Kenny <[email protected]> wrote: > Just to chime in.. my understanding of the vc compiler is that it is the > same for all these cases. The community, profession and enterprise is abo= ut > extra paid features of the IDE. While these are all side by side > installable.. the code you build, as I understand, is the same. For me at > least I don=E2=80=99t see what value exists yet in selecting license leve= l values > of the MSVS > *All =E2=80=93 please respond with any corrections and clarifications if an= ything below is inaccurate or misleading. * In general, this assessment is accurate. With respect to the current SCons implementation however, an important qualification is necessary and is illustrated below. There is a potentially rare problem that only manifests itself when multiple product instances (i.e., Enterprise, Professional, Community, and Build Tools) of the same version are installed due to the current instance selection implementation for 2017 and 2019 based on the vswhere tool. Given two or more installations of Enterprise, Professional, and Community: the expected build *behavior is the same given that the installed features and target toolsets are the same*. Given two or more installations of Enterprise, Professional, and Community: the expected build behavior *can be different if the installed features or target toolsets are different*. Herein lies the rub. Currently, the selected MSVS instance is independent of the required host/target architecture and toolset for the build. With multiple instances of the same product installed, it is possible an installed instance is selected that does not fulfill the required features/toolsets despite the presence of installed instances that do fulfill the required features/toolsets. Consider the following installations of MSVS 2019: - MSVS 2019 Enterprise: only toolsets targeting windows x64/x86 - MSVS 2019 Community: only toolsets targeting arm/arm64. In this case: - If 2019 Enterprise is always returned: arm/arm64 builds would fail - If 2019 Community is always returned: x64/x86 builds would fail The Visual Studio Installer offers a smorgasbord of independently selected features (e.g., ATL, MFC), targets (e.g., arm, arm64), and toolsets. Toolsets can be identified by the folder layout and existence of tool binaries within an MSVS installation. Features are likely difficult or impossible to identify. It could be possible that an end-user may not want to modify a corporate/IT supplied Enterprise instance or may be restricted from making changes. In this case, installing the Community edition makes sense. For example, x86/x64 software for work and arm/arm64 software for pleasure. Similar examples with =E2=80=9Cfeatures=E2=80=9D could apply as well: one i= nstance might have ATL+MFC support installed while another instance does not. In this case, there would be a problem if the instance without ATL+MFC were selected. Given multiple instances installed with the same products and features, it may be desirable to install updates (e.g., minor toolset updates) in one instance and test with that particular instance prior to propagating the same updates to the other instances. While extremely rare, code generation bugs are possible in a minor toolset update. Reliance on =E2=80=9Cundocumented=E2=80=9D features also can also be problematic when s= witching products and toolsets. With a corporate/it managed instance, updates may be less frequent than a user-managed instance. Given two or more instances installed, it may be desirable to force a build using the same product type as a customer and/or a production build environment for purposes of verification and validation. If nothing else, it is useful for testing SCons J I am unaware of any documentation that describes the order in which vswhere would return instances of Enterprise, Professional, and Community if all three were present. Alphabetical? Last installed to first installed? License level? I don't have access to licensed versions of the Enterprise and Professional products. With respect to the current SCons implementation, expansion of the user-defined product specification would be useful even without specific toolset version support for the situations outlined above. The mechanism necessary to be able to select the =E2=80=9CBuild Tools=E2=80= =9D instance when one or more Enterprise/Professional/Community instances is likely general enough to be extended to cover all instances at little to no extra cost. As for generated output, starting with 2015 all of the product instances (i.e., Enterprise, Professional, Community, Build Tools, and Express) are binary compatible both within a toolset (e.g, v141) and across toolsets (e.g, v140, v141, and v142) subject to limitations. See below. Regards, Joe https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view= =3Dvs-2019#:~:text=3DThe%20Microsoft%20C%2B%2B%20(MSVC)%20compiler,executab= les%20built%20by%20different%20versions.&text=3DYou%20can%20still%20use%20t= hem,Visual%20Studio%202017%20or%202019. =E2=80=A6 *C++ binary compatibility between Visual Studio 2015, 2017, and 2019* The Microsoft C++ (MSVC) compiler toolsets in Visual Studio 2013 and earlier don't guarantee binary compatibility across versions. You can't link object files, static libraries, dynamic libraries, and executables built by different versions. The ABIs, object formats, and runtime libraries are incompatible. We've changed this behavior in Visual Studio 2015, 2017, and 2019. The runtime libraries and apps compiled by any of these versions of the compiler are binary-compatible. It's reflected in the C++ toolset major number, which is 14 for all three versions. (The toolset version is v140 for Visual Studio 2015, v141 for 2017, and v142 for 2019). Say you have third-party libraries built by Visual Studio 2015. You can still use them in an application built by Visual Studio 2017 or 2019. There's no need to recompile with a matching toolset. The latest version of the Microsoft Visual C++ Redistributable package (the Redistributable) works for all of them. There are three important restrictions on binary compatibility: - You can mix binaries built by different versions of the toolset. However, you must use a toolset at least as recent as the most recent binary to link your app. Here's an example: you can link an app compiled using the 2017 toolset to a static library compiled using 2019, if they'= re linked using the 2019 toolset. - The Redistributable your app uses has a similar binary-compatibility restriction. When you mix binaries built by different supported versions= of the toolset, the Redistributable version must be at least as new as the latest toolset used by any app component. - Static libraries or object files compiled using the /GL (Whole program optimization) <https://docs.microsoft.com/en-us/cpp/build/reference/gl-whole-program-o= ptimization?view=3Dvs-2019> compiler switch *aren't* binary-compatible across versions. All object files and libraries compiled using /GL must use exactly the same toolset for the compile and the final link. *=E2=80=A6* --0000000000006a578c05acd7689a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Tue, Aug 11, 2020 at 10:52 PM Jason Ke= nny <<a href=3D"mailto:[email protected]">[email protected]</a>> wr= ote:<br></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" = style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa= dding-left:1ex"> <div lang=3D"EN-US"> <div class=3D"gmail-m_-2604319923434649382WordSection1"> <p class=3D"MsoNormal">Just to chime in.. my understanding of the vc compil= er is that it is the same for all these cases. The community, profession an= d enterprise is about extra paid features of the IDE. While these are all s= ide by side installable.. the code you build, as I understand, is the same. For me at least I don=E2=80=99t s= ee what value exists yet in selecting license level values of the MSVS</p><= /div></div></blockquote><div><br></div><div><p class=3D"MsoNormal" style=3D= "margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><i>= All =E2=80=93 please respond with any corrections and clarifications if anything below is inaccurate or misleading. </i></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">In general, this assessment is accurate.=C2=A0 With respect to the current SCons implementation however, an important qualification is necessary and is illustrated below.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">There is a potentially rare problem that only m= anifests itself when multiple product instances (i.e., Enterprise, Professional, Community, and Build Tools) of the same version are installed due to the cu= rrent instance selection implementation for 2017 and 2019 based on the vswhere to= ol.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Given two or more installations of Enterprise, = Professional, and Community:=C2=A0 the expected build <i>behavior is the same given that = the installed features and target toolsets are the same</i>.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Given two or more installations of Enterprise, = Professional, and Community:=C2=A0 the expected build behavior <i>can be different if the installed features or target toolsets are different</i>.=C2=A0 Herein lies = the rub.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Currently, the selected MSVS instance is indepe= ndent of the required host/target architecture and toolset=C2=A0for the build.=C2=A0 With multiple instances = of the same product installed, it is possible an installed instance is selected that does not fulfill the required features/toolsets despite the presence of installed instances that do fulfill the required features/toolsets.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Consider the following installations of MSVS 20= 19:</p><p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt"><span style= =3D"font-family:Calibri,sans-serif;font-size:11pt">-</span><font face=3D"Ti= mes New Roman" size=3D"1">=C2=A0</font><span style=3D"font-family:Calibri,s= ans-serif;font-size:11pt">MSVS 2019 Enterprise: only toolsets targeting windows x64/x86</span></p><p class=3D"MsoNormal" style=3D"margin:0in 0in 0.= 0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style=3D"font-s= ize:11pt">-</span><span style=3D"font-variant-numeric:normal;font-variant-e= ast-asian:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-= family:"Times New Roman"">=C2=A0</span><span style=3D"font-size:1= 1pt">MSVS 2019 Community: only toolsets targeting arm/arm64.</span></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">In this case:</p><p class=3D"MsoNormal" style= =3D"margin:0in 0in 0.0001pt"><span style=3D"font-family:Calibri,sans-serif;= font-size:11pt">-</span><font face=3D"Times New Roman" size=3D"1">=C2=A0</f= ont><span style=3D"font-family:Calibri,sans-serif;font-size:11pt">If 2019 E= nterprise is always returned: arm/arm64 builds would fail</span></p><p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001p= t"><span style=3D"font-family:Calibri,sans-serif;font-size:11pt">-</span><f= ont face=3D"Times New Roman" size=3D"1">=C2=A0</font><span style=3D"font-fa= mily:Calibri,sans-serif;font-size:11pt">If 2019 Community is always returne= d: x64/x86 builds would fail</span></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">The Visual Studio Installer offers a smorgasbor= d of independently=C2=A0selected features (e.g., ATL, MFC), targets (e.g., = arm, arm64), and toolsets.=C2=A0 Toolsets can be identified by the folder layout= and existence of tool=C2=A0binaries within an MSVS installation.=C2=A0 Fea= tures are likely difficult or impossible to identify.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">It could be possible that an end-user may not want to modify a corporate/IT supplied Enterprise = instance or may be restricted from making changes.=C2=A0 In this case, installing the Community edition makes sense.=C2=A0 For examp= le, x86/x64 software for work and arm/arm64 software for pleasure.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Similar examples with =E2=80=9Cfeatures=E2=80= =9D could apply as well: one instance might have ATL+MFC support installed while another instance does not.=C2=A0= In this case, there would be a problem if the instance without ATL+MFC were selected.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Given multiple instances installed with the sam= e products and features, it may be desirable to install updates (e.g., minor toolset updates) in one instance and test with that particular instance prior to pr= opagating the same updates to the other instances. =C2=A0=C2=A0While extremely rare, = code generation bugs are possible in a minor toolset update. Reliance on =E2=80=9Cundocumented=E2=80=9D features also can also be proble= matic when switching products and toolsets.=C2=A0 With a corporate/it managed instance, updates may be less frequent than a user-man= aged instance.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Given two or more instances installed, it may b= e desirable to force a build using the same product type as a customer and/or a production build environment for purposes of verific= ation and validation.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">If nothing else, it is useful for testing SCons= <span style=3D"font-family:Wingdings">J</span></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p><p class=3D"MsoNormal" style=3D"margi= n:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">I am unaw= are of any documentation that describes the order in which vswhere would re= turn instances of Enterprise, Professional, and Community if all three were= present.=C2=A0 Alphabetical? Last installed to first installed?=C2=A0 Lice= nse level?=C2=A0 I don't have access to licensed versions of the Enterp= rise and Professional products.</p><p class=3D"MsoNormal" style=3D"margin:0= in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">With respect to the current SCons implementatio= n, expansion of the user-defined product specification would be useful even without spec= ific toolset version support for the situations outlined above.=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">The mechanism necessary to be able to select th= e =E2=80=9CBuild Tools=E2=80=9D instance when one or more Enterprise/Professional/Community = instances is likely general enough to be extended to cover all instances at little to no extra cost.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">As for generated output, starting with 2015 all= of the product instances (i.e., Enterprise, Professional, Community, Build Tools, = and Express) are binary compatible both within a toolset (e.g, v141) and across toolsets (e.g, v140, v141, and v142) subject to limitations.=C2=A0 See belo= w.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Regards,</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">Joe</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif"><a href=3D"https://docs.microsoft.com/en-us/cpp= /porting/binary-compat-2015-2017?view=3Dvs-2019#:~:text=3DThe%20Microsoft%2= 0C%2B%2B%20(MSVC)%20compiler,executables%20built%20by%20different%20version= s.&text=3DYou%20can%20still%20use%20them,Visual%20Studio%202017%20or%20= 2019." style=3D"color:blue">https://docs.microsoft.com/en-us/cpp/porting/bi= nary-compat-2015-2017?view=3Dvs-2019#:~:text=3DThe%20Microsoft%20C%2B%2B%20= (MSVC)%20compiler,executables%20built%20by%20different%20versions.&text= =3DYou%20can%20still%20use%20them,Visual%20Studio%202017%20or%202019.</a></= p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=E2=80=A6</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif"><b>C++ binary compatibility between Visual Stud= io 2015, 2017, and 2019</b></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">The Microsoft C++ (MSVC) compiler toolsets in V= isual Studio 2013 and earlier don't guarantee binary compatibility across versions. = You can't link object files, static libraries, dynamic libraries, and execu= tables built by different versions. The ABIs, object formats, and runtime librarie= s are incompatible.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">We've changed this behavior in Visual Studi= o 2015, 2017, and 2019. The runtime libraries and apps compiled by any of these versions of t= he compiler are binary-compatible. It's reflected in the C++ toolset major= number, which is 14 for all three versions. (The toolset version is v140 for Visual Studio 2015, v141 for 2017, and v142 for 2019). Say you have third-party libraries built by Visual Studio 2015. You can still use them in an applica= tion built by Visual Studio 2017 or 2019. There's no need to recompile with = a matching toolset. The latest version of the Microsoft Visual C++ Redistributable package (the Redistributable) works for all of them.</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">=C2=A0</p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif">There are three important restrictions on binar= y compatibility:</p> <ul style=3D"margin-top:0in;margin-bottom:0in" type=3D"disc"> <li class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;fo= nt-family:Calibri,sans-serif">You can mix binaries built by different versions of the toolset. However, = you must use a toolset at least as recent as the most recent binary to lin= k your app. Here's an example: you can link an app compiled using th= e 2017 toolset to a static library compiled using 2019, if they're linked= using the 2019 toolset.</li> <li class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;fo= nt-family:Calibri,sans-serif">The Redistributable your app uses has a similar binary-compatibility restriction. When you mix binaries built by different supported versio= ns of the toolset, the Redistributable version must be at least as new as= the latest toolset used by any app component.</li> <li class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;fo= nt-family:Calibri,sans-serif">Static libraries or object files compiled using the=C2=A0<a href=3D"https://d= ocs.microsoft.com/en-us/cpp/build/reference/gl-whole-program-optimization?v= iew=3Dvs-2019" style=3D"color:blue">/GL (Whole program optimization)</a>=C2=A0compiler switch=C2=A0<i>aren'= ;t</i>=C2=A0binary-compatible across versions. All object files and libraries compiled using=C2=A0/G= L=C2=A0must use exactly the same toolset for the compile and the final link.</li> </ul> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif"><b>=C2=A0</b></p> <p class=3D"MsoNormal" style=3D"margin:0in 0in 0.0001pt;font-size:11pt;font= -family:Calibri,sans-serif"><b>=E2=80=A6</b></p></div><div>=C2=A0</div></di= v></div> --0000000000006a578c05acd7689a-- --===============6232700144213001496== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Scons-dev mailing list [email protected] https://pairlist2.pair.net/mailman/listinfo/scons-dev --===============6232700144213001496==--