[vlc-devel] [PATCH] package/win32: build.sh: Force Win7 and MSVCRT when not using UCRT
Martin Storsjö
martin at martin.st
Tue Jun 2 15:09:13 CEST 2020
On Tue, 2 Jun 2020, Steve Lhomme wrote:
> On 2020-06-02 12:00, Martin Storsjö wrote:
>> On Tue, 2 Jun 2020, Steve Lhomme wrote:
>>
>>> That's the minimum we support in VLC 4.0.
>>>
>>> The CRT version to set for UCRT is 0xE00.
>>
>> To select the UCRT, it's enough to just define _URT - you can do either
>
> I suppose you mean _UCRT.
Yeah
>> that or define __MSVCRT_VERSION__=0xE00, but you don't do both.
>
> OK. I suppose it doesn't hurt though.
>
> When *not* selecting UCRT the selection is done as this:
> #ifndef __MSVCRT_VERSION__
> /* High byte is the major version, low byte is the minor. */
> # ifndef _UCRT
> # define __MSVCRT_VERSION__ @DEFAULT_MSVCRT_VERSION@
> # else
> # define __MSVCRT_VERSION__ 0xE00
> # endif
> #endif
>
> It seems better to set the __MSVCRT_VERSION__ to make sure that's the
> one we want. So I would rather be consistent in the two modes.
Sure. From the mingw-w64 point of view it's meant that you can use either
for selecting mode, but to be sure that it really overrides properly in
case something else also defines __MSVCRT_VERSION__, I guess it's safer to
just set __MSVCRT_VERSION__ in both cases.
>> Switching between msvcrt versions like this, on top of one single
>> toolchain, works as long as you don't rely on other prebuilt libraries
>> that depend on CRT specific details. In particular, the prebuilt libc++
>> is closely tied to the CRT used, so I'm afraid this approach doesn't
>> work reliably for C++ code - unless you plan on building that as part of
>> the VLC build as well.
>
> I first go into this because the current LLVM-MINGW builds use UCRT (so
> don't run on a simple Win7 machine). I hoped it was possible to switch
> between one another but I feared what you describe.
> So I think we should rebuild our LLVM-MINGW toolchain to support msvcrt
> which is what we'll use for Win7 compatibility.
> We should probably have a UCRT version on the side as well.
Indeed. If building manually you can specify the default as a parameter to
build-mingw-w64.sh, and if building with the docker images, you can add
"--build-arg DEFAULT_CRT=msvcrt" to the docker build command, to pick
which one you want.
(There's been other requests for toolchains defaulting to msvcrt, so I
might make other binary releases that default to that as well, but for vlc
docker buildbot use, just building two images with different defaults is
probably best.)
// Martin
More information about the vlc-devel
mailing list