Hi,

Thanks to both of you for taking the time to file the bug and investigate
this!

On Thu, 21 Nov 2019 12:09:44 +0100, Marius Mikučionis <mmikucio...@gmail.com>
wrote:
> 2019-11-21, kt, 01:16 Bernhard Übelacker <bernha...@mailbox.org> rašė:
> > First I fear that mingw-w64 does not link as much static
> > as you expect it to.

Yes, strftime and most other C library functions are implemented in the
underlying CRT, not MinGW-w64.

> > And the Microsoft page might just be right for later versions
> > of c runtimes they provide.

I think so too; there’s a drop-down to select different versions of Visual
Studio, but all the versions for which documentation is currently provided
use UCRT.

> > Further I found this information [2], which is as far as
> > I understand about recompiling mingw.
> > But I tried just to modify the compile/link command,
> > which I guess is kind of the expected output?
> >
> >     $ i686-w64-mingw32-gcc -static -O3 -Wall -o strftime-ucrt-7.exe
> > strftime.c -lucrt
> >     $ i686-w64-mingw32-objdump -p strftime-ucrt-7.exe | grep 'DLL Name:'
> >             DLL Name: KERNEL32.dll
> >             DLL Name: msvcrt.dll
> >             DLL Name: api-ms-win-crt-environment-l1-1-0.dll
> >             DLL Name: api-ms-win-crt-heap-l1-1-0.dll
> >             DLL Name: api-ms-win-crt-private-l1-1-0.dll
> >             DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
> >             DLL Name: api-ms-win-crt-stdio-l1-1-0.dll
> >             DLL Name: api-ms-win-crt-string-l1-1-0.dll
> >             DLL Name: api-ms-win-crt-time-l1-1-0.dll
> 
> I can reproduce this too.

Yes, this is normal. Doing a proper link with UCRT requires at minimum
overriding the GCC spec file, as described in
https://sourceforge.net/p/mingw-w64/mailman/message/36621319/

> >     $ wine strftime-ucrt-7.exe
> >     [%a]: [Tue]
> >     [%e]: [ 5]
> >     [%d]: [05]
> >     [%-d]: (empty) errno=22
> >     [%#d]: [5]
> >     [%b]: [Nov]
> >     [%Y]: [2019]
> >     [%H]: [03]
> >     [%M]: [02]
> >     [%S]: [01]
> >     [%z]: [+0100]
> >     [%Z]: [Mitteleuropõische Zeit]
> >     [%b%e, %Y, %H:%M:%S %z]: [Nov 5, 2019, 03:02:01 +0100]
> >
> > (msvcrt.dll still appears; the same result for 7.0.0-2 and 6.0.0-3.)
> 
> Your output is correct, but I am not getting that, very strange.

I’m guessing this works for Bernhard because he’s using a newer version of
Wine than either Marius or myself; %e was implemented in 4.18, for _MSVCR_VER
140 or later, and %z in 4.20.

> > At least the binaries produced in my tests behave the same
> > in Wine and Windows.
> 
> Even without -lucrt ?
> The ucrt adds those api-ms-win-crt-* dependencies, which do not seem to be
> necessary.

They’re all part of the UCRT interface; you’ll get the same dependencies with
Visual Studio.

> Thank you for the effort, perhaps something strange is happening with my
> setup, I could not find anyone else on internet with this issue.

There’s nothing strange in your setup!

I’m wondering what the appropriate solution is. Strictly speaking, this isn’t
a bug in MinGW-w64, and using the default MSVCRT target there’s nothing much
we can do. However it does raise the question of UCRT support in Debian...

Regards,

Stephen

Attachment: pgpEf7xwAAb9H.pgp
Description: OpenPGP digital signature

Reply via email to