Subject: Re: bug#12728: v8.20 is missing LIBICONV for factor tool

From: Jim Meyering <[email-masked]>
Date: Thu, 25 Oct 2012 12:21:31 +0200

Pádraig Brady wrote:

> On 10/25/2012 05:30 AM, Christian Jullien wrote:
>> Hi maintainers,
>>
>> Trying to compile new 8.20 version on my Solaris 10 sparc machine using gcc
>> 4.7.2, I got an error on factor link:
>>
>> CCLD   src/factor
>>
>> lib/libcoreutils.a(striconv.o): In function `mem_cd_iconv':
>>
>> /export/home/jullien/coreutils-8.20/lib/striconv.c:55: undefined reference
>> to `libiconv'
>
> Right you are.
> This is required in the new factor because of:
>
>   proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"),   \
>   proper_name_utf8 ("Niels Moller", "Niels M\303\266ller")
>
> I didn't pick up the issue on my gcc 3.4.3, solaris 10, sparc
> test system because of:
>
>   $ grep ICONV lib/config.h
>   /* #undef HAVE_ICONV */
>   #define HAVE_ICONV_H 1
>   #define ICONV_CONST const
>   #define ICONV_FLAVOR ICONV_FLAVOR_SOLARIS
>
> To fix this up I'll add in:
>
> diff --git a/src/local.mk b/src/local.mk
> index 6a01ef1..f40f681 100644
> --- a/src/local.mk
> +++ b/src/local.mk
> @@ -277,6 +277,7 @@ src_cat_LDADD += $(LIBICONV)
>  src_cp_LDADD += $(LIBICONV)
>  src_df_LDADD += $(LIBICONV)
>  src_du_LDADD += $(LIBICONV)
> +src_factor_LDADD += $(LIBICONV)
>  src_getlimits_LDADD += $(LIBICONV)
>  src_printf_LDADD += $(LIBICONV)
>  src_ptx_LDADD += $(LIBICONV)

Thanks for dealing with that.
Along with the fix, please add a syntax-check rule that does something
like this:

  cd src; for i in $(git grep -l -w proper_name_utf8 *.c|sed 's/\.c//'); do
    grep -E "^src_${i}_LDADD .?= .*\$(LIBICONV)" local.mk > /dev/null \
      || echo FAIL $i
  done

Before the fix, it would print this:

  FAIL factor