bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyich@gmail.com>
To: Bruno Haible <bruno@clisp.org>, bug-gnulib@gnu.org
Subject: Re: gnulib does not always detect need for iconv() hack on musl
Date: Sun, 17 Oct 2021 19:13:08 +0100	[thread overview]
Message-ID: <YWxntATVkcGOys6N@nz> (raw)
In-Reply-To: <3670291.xsyPL9o34G@omega>

On Sun, Oct 17, 2021 at 07:18:51PM +0200, Bruno Haible wrote:
> Hello Sergei,
> 
> Sergei Trofimovich wrote:
> > The following fails bison-3.8.2 tests:
> >     $ ./configure && make && make check
> > The following succeeds:
> >     $ ./configure --host=x86_64-unknown-linux-musl && make && make check
> > 
> > The failure happens due to unexpected '*' output in report logs instead
> > of '%empty' on 'ASCII' locales.
> > 
> > These unexpected '*' pop back again because gnulib relies on '--host='
> > parameter for './configure' to detect musl target (for lack of better
> > signal?):
> > 
> >   https://git.savannah.gnu.org/cgit/gnulib.git/tree/m4/musl.m4#n16
> > 
> >     case "$host_os" in
> >       *-musl*) AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) ;;
> > 
> >   https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/unicodeio.c#n151
> > 
> >     /* FreeBSD iconv(), NetBSD iconv(), and Solaris 11 iconv() insert
> >        a '?' if they cannot convert.  */
> >     # if !defined _LIBICONV_VERSION
> >               || (res > 0 && outptr - outbuf == 1 && *outbuf == '?')
> >     # endif
> >       /* musl libc iconv() inserts a '*' if it cannot convert.  */
> >     # if !defined _LIBICONV_VERSION && MUSL_LIBC
> >               || (res > 0 && outptr - outbuf == 1 && *outbuf == '*')
> >     # endif
> >          )
> >         return failure (code, NULL, callback_arg);
> > 
> > What do you think of enabling the workaround regardless of MUSL_LIBC
> > define?
> 
> The MUSL_LIBC symbol is supposed to be set on musl platforms; this is
> what musl.m4 is for. The difference between your two invocations is that
> in the first case, it used a $host triple inferred by config.guess,
> while in the second case, it used the $host that you specified on the
> command line.
> 
> When I try your two commands (just the configure step), the first one
> prints
>   checking for host system type... x86_64-pc-linux-musl
> while the second one prints
>   checking for host system type... x86_64-unknown-linux-musl
> 
> The next steps of the investigation are: In the first case,
>   - What did the "checking for host system type..." line look like?
>   - Which of the environment variables CC_FOR_BUILD, HOST_CC, CC,
>     CONFIG_SITE did you have defined, and to which values?

Aha, 'config.guess' clearly detects wrong libc here:

  checking build system type... x86_64-pc-linux-gnu
  checking host system type... x86_64-pc-linux-gnu

I did not realize 'config.guess' has the code to detect libc but it
clearly does. I'll dig from there and complain elsewhere.

Thank you!

-- 

  Sergei


  reply	other threads:[~2021-10-17 18:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-17 14:14 gnulib does not always detect need for iconv() hack on musl Sergei Trofimovich
2021-10-17 17:18 ` Bruno Haible
2021-10-17 18:13   ` Sergei Trofimovich [this message]
2021-10-17 19:27     ` Bruno Haible
2021-10-18  0:27       ` Bruno Haible
2021-10-18  8:16         ` Sergei Trofimovich

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=YWxntATVkcGOys6N@nz \
    --to=slyich@gmail.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).