All of lore.kernel.org
 help / color / mirror / Atom feed
From: "罗勇刚(Yonggang Luo)" <luoyonggang@gmail.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "QEMU Trivial" <qemu-trivial@nongnu.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-level <qemu-devel@nongnu.org>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH v6 2/4] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw
Date: Sat, 3 Oct 2020 01:47:02 +0800	[thread overview]
Message-ID: <CAE2XoE_+ERRdDgGcisNj0WWMU=rCs49PrikVw6Tk+Ov2TC0+Tw@mail.gmail.com> (raw)
In-Reply-To: <20201002164232.GO2338114@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4436 bytes --]

On Sat, Oct 3, 2020 at 12:42 AM Daniel P. Berrangé <berrange@redhat.com>
wrote:
>
> On Sat, Oct 03, 2020 at 12:38:50AM +0800, 罗勇刚(Yonggang Luo) wrote:
> > On Fri, Oct 2, 2020 at 11:36 PM Daniel P. Berrangé <berrange@redhat.com>
> > wrote:
> > >
> > > On Fri, Oct 02, 2020 at 01:32:28AM +0800, Yonggang Luo wrote:
> > > > msys2/mingw lacks the POSIX-required langinfo.h.
> > > >
> > > > gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe
> > -lncursesw -lgnurx -ltre -lintl -liconv
> > > > test.c:4:10: fatal error: langinfo.h: No such file or directory
> > > >     4 | #include <langinfo.h>
> > > >       |          ^~~~~~~~~~~~
> > > > compilation terminated.
> > > >
> > > > So we using g_get_codeset instead of nl_langinfo(CODESET)
> > > >
> > > > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > > > Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
> > > > ---
> > > >  ui/curses.c | 10 +++++-----
> > > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/ui/curses.c b/ui/curses.c
> > > > index a59b23a9cf..12bc682cf9 100644
> > > > --- a/ui/curses.c
> > > > +++ b/ui/curses.c
> > > > @@ -30,7 +30,6 @@
> > > >  #endif
> > > >  #include <locale.h>
> > > >  #include <wchar.h>
> > > > -#include <langinfo.h>
> > > >  #include <iconv.h>
> > > >
> > > >  #include "qapi/error.h"
> > > > @@ -526,6 +525,7 @@ static void font_setup(void)
> > > >      iconv_t nativecharset_to_ucs2;
> > > >      iconv_t font_conv;
> > > >      int i;
> > > > +    g_autofree gchar *local_codeset = g_get_codeset();
> > > >
> > > >      /*
> > > >       * Control characters are normally non-printable, but VGA does
have
> > > > @@ -566,14 +566,14 @@ static void font_setup(void)
> > > >        0x25bc
> > > >      };
> > > >
> > > > -    ucs2_to_nativecharset = iconv_open(nl_langinfo(CODESET),
"UCS-2");
> > > > +    ucs2_to_nativecharset = iconv_open(local_codeset, "UCS-2");
> > > >      if (ucs2_to_nativecharset == (iconv_t) -1) {
> > > >          fprintf(stderr, "Could not convert font glyphs from UCS-2:
> > '%s'\n",
> > > >                          strerror(errno));
> > > >          exit(1);
> > > >      }
> > > >
> > > > -    nativecharset_to_ucs2 = iconv_open("UCS-2",
nl_langinfo(CODESET));
> > > > +    nativecharset_to_ucs2 = iconv_open("UCS-2", local_codeset);
> > > >      if (nativecharset_to_ucs2 == (iconv_t) -1) {
> > > >          iconv_close(ucs2_to_nativecharset);
> > > >          fprintf(stderr, "Could not convert font glyphs to UCS-2:
> > '%s'\n",
> > > > @@ -581,7 +581,7 @@ static void font_setup(void)
> > > >          exit(1);
> > > >      }
> > > >
> > > > -    font_conv = iconv_open(nl_langinfo(CODESET), font_charset);
> > > > +    font_conv = iconv_open(local_codeset, font_charset);
> > > >      if (font_conv == (iconv_t) -1) {
> > > >          iconv_close(ucs2_to_nativecharset);
> > > >          iconv_close(nativecharset_to_ucs2);
> > > > @@ -602,7 +602,7 @@ static void font_setup(void)
> > > >      /* DEL */
> > > >      convert_ucs(0x7F, 0x2302, ucs2_to_nativecharset);
> > > >
> > > > -    if (strcmp(nl_langinfo(CODESET), "UTF-8")) {
> > > > +    if (strcmp(local_codeset, "UTF-8")) {
> > >
> > > If you're removing use of nl_langinfo / langinfo.h then you need
> > > to also update configure, because it is checking for this function
> > > and header file when validating curses library support.
> > The change of configure are waiting for meson 0.56, so I didn't post
that
> > yet And this patch
> > is a pre-request for msys2/mingw support and won't hurt other platform
> >
> > We are converting everything to meson, so I am not willing to change
> > configure this time
>
> I don't see why the configure change has any dependancy on meson 0.56.
> It just requires you to remove the mentioned header file and function
> from the configure check. This patch needs to include that or it is
> incomplete IMHO
>
Because the configure script change far more complicated than you imgaine.
And I post that before
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-
https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-
https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-
https://www.instagram.com/dberrange :|
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 6431 bytes --]

  parent reply	other threads:[~2020-10-02 17:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 17:32 [PATCH v6 0/4] Fixes curses on msys2/mingw Yonggang Luo
2020-10-01 17:32 ` [PATCH v6 1/4] configure: fixes indent of $meson setup Yonggang Luo
2020-10-02 15:34   ` Daniel P. Berrangé
2020-10-01 17:32 ` [PATCH v6 2/4] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Yonggang Luo
2020-10-02 15:35   ` Daniel P. Berrangé
2020-10-02 16:38     ` 罗勇刚(Yonggang Luo)
2020-10-02 16:42       ` Daniel P. Berrangé
2020-10-02 17:46         ` Paolo Bonzini
2020-10-02 17:47         ` 罗勇刚(Yonggang Luo) [this message]
2020-10-02 17:49           ` Paolo Bonzini
2020-10-02 17:54             ` 罗勇刚(Yonggang Luo)
2020-10-01 17:32 ` [PATCH v6 3/4] curses: Fixes curses compiling errors Yonggang Luo
2020-10-01 17:32 ` [PATCH v6 4/4] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw Yonggang Luo
2020-10-02 15:36   ` Daniel P. Berrangé
2020-10-01 17:39 ` [PATCH v6 0/4] Fixes curses " Paolo Bonzini
2020-10-02 12:47   ` Gerd Hoffmann
2020-10-02 15:38     ` Daniel P. Berrangé
2020-10-12  6:49       ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAE2XoE_+ERRdDgGcisNj0WWMU=rCs49PrikVw6Tk+Ov2TC0+Tw@mail.gmail.com' \
    --to=luoyonggang@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.