> -----Original Message-----
> From: Martin Storsjö <mar...@martin.st>
> Sent: Saturday, December 14, 2019 3:55 AM
> To: mingw-w64-public@lists.sourceforge.net
> Subject: Re: [Mingw-w64-public] gettext 0.19.8.1 build error with GCC 9.2.0
> 
> On Sat, 14 Dec 2019, Liu Hao wrote:
> 
> > 在 2019/12/14 4:17, Martin Storsjö 写道:
> >> For some reason, gnulib tries to provide its own function mbsinit
> >> (which is used for checking if an mbstate_t is initialized or not),
> >> even if one is provided. (I guess the reason for this misdetection,
> >> is that in UCRT mode, mbsinit is purely available as an inline
> >> function, there's no function available in the UCRT dll, and the
> >> gnulib check might only test linking without using the right header.)
> >>
> >> Perhaps we should provide a custom mbsinit function in the UCRT
> >> import libraries - that should hopefully make gnulib realize the
> >> function exists, and avoid trying to provide it.
> >>
> >
> > Referring to the file 'mbsinit.m4' in GnuLib I get this:
> >
> > ```m4
> >    if test $REPLACE_MBSTATE_T = 1; then
> >      REPLACE_MBSINIT=1
> >    else
> >      dnl On mingw, mbsinit() always returns 1, which is inappropriate for
> >      dnl states produced by mbrtowc() for an incomplete multibyte character
> >      dnl in multibyte locales.
> >      case "$host_os" in
> >        mingw*) REPLACE_MBSINIT=1 ;;
> >      esac
> >    fi
> > ```
> >
> > Thus I presume that providing an out-of-line `mbsinit()` will not fix
> > the issue, as it is replaced unconditionally if the triplet matches
> > `*-*-mingw*`.
> 
> Ah, yes, indeed.
> 
> But there's another plot twist. If mbsinit is deemed to be missing (as it is 
> with
> ucrt right now), gnulib also replaces the definition of mbstate_t like this:
> 
> typedef int rpl_mbstate_t;
> #undef mbstate_t
> #define mbstate_t rpl_mbstate_t
> 
> That's why the gnulib-provided mbsinit has built fine for me - but if actually
> providing mbsinit, it breaks as gnulib still tries to build its own mbsinit, 
> but
> using the system's mbstate_t type.
> 
> So I'd guess that to reach the error Tom got, configure would have detected
> an mbsinit function. Not sure how that happens though, unless using a mixed
> set of headers and libs (headers for ucrt but libs targeting msvcrt).
> 

I tried with gettext with the base MnGW-w64 compilers, not the custom tool
chain I have built, and ran into the same problem.

I am going to start with a clean msys2/mingw-w64 setup and see if the problem
reproduces.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to