[Mingw-users] Yet another compilation problem with building gcc 7.3.0

Back to archive index

Keith Marshall keith****@users*****
Fri Jun 29 19:10:10 JST 2018


On 29/06/18 07:26, Eli Zaretskii wrote:
>> From: David Gressett <DGres****@amli-*****>
>> Date: Thu, 28 Jun 2018 21:52:07 -0500
>> ../../../src/gcc-7.3.0/gcc/ada/rtinit.c:195:44: error:
>> '_O_U16TEXT' was not declared in this scope
>>               __gnat_current_ccs_encoding = _O_U16TEXT;
>>
>> The other two undefined items were _O_WTEXT and _O_U8TEXT.
>> For all three of these, the compiler suggested _O_TEXT as an
>> alternative.
>> 
>> rtinit.c includes <fcntl.h> which defines the three undefined items:
>>
>> #if (__MSVCRT_VERSION__ >= 0x0800)
>> #define _O_WTEXT	0x10000
>> #define _O_U16TEXT	0x20000
>> #define _O_U8TEXT	0x40000
>> #endif
>>
>> fcntl.h includes _mingw.h which includes mscrtver.h, which defines
>> a default value for __MSVCRT_VERSION__
>>
>> The default value is 0x0600, so unless an overriding #define
>> produces a larger value, these constants will be undefined.
> 
> AFAIU, the above means that the Ada compiler has dropped support of
> Windows versions before Vista, and the compiler you produce will be
> unable to run on those older versions as it does on Windows 7 and
> later.  Unless, that is, the source has some fallback for those older
> versions (and _O_TEXT sounds like a good idea to me up front), but I
> didn't look at the sources to see if they do have such a fallback, and
> I don't really understand what that will do, since UTF-16 text will
> not be supported that way.
> 
> If you never intend to have your compiler to run on older systems,
> just define __MSVCRT_VERSION__ to the higher number, I'd say.
> 
> Keith will probably have a better insight.

Well, I really cannot condone any suggestion to arbitrarily define
__MSVCRT_VERSION__; its purpose is to declare intent to link with one of
Microsoft's non-free (not freely distributable) runtimes, such as
MSVCR80.DLL or later, *instead* of the OS-provided MSVCRT.DLL.  As such,
the *only* way it should *ever* be defined to a non-default value is via
a custom GCC specs file, which *replaces* MSVCRT.DLL with the
corresponding non-free alternative, in the list of default libraries
passed to the linker.

As David notes, the default value for __MSVCRT_VERSION__ is specified as
0x0600; this, or any lesser value, is interpreted as a declaration of
intent to maintain compatibility with default MSVCRT.DLL linking
behaviour.  Comments within <msvcrtver.h>, (for which I assume David's
reference to <mscrtver.h> is a typo), explain this.

That said, if Vista and later versions of MSVCRT.DLL now expose APIs to
which these __MSVCRT_VERSION__ restricted constants relate, then the
restriction in <fcntl.h> should reflect that, with a _WIN32_WINNT
minimum version test to complement the __MSVCRT_VERSION__ restriction.

Would anyone care to propose a test case for such version specific
support?  I no longer use Windows for any daily purpose, but I do still
have the ability to test compatibility for WinXP and Win7, running
either as a virtual machine.  Would anyone else be able to assist with
testing on other (esp. legacy) Windows versions?

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180629/36ec04fe/attachment.pgp 



More information about the MinGW-Users mailing list
Back to archive index