bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends)
@ 2020-02-05  9:02 Jeffrey Walton
  2020-02-05 12:39 ` Jeffrey Walton
  2020-02-05 14:53 ` Bruno Haible
  0 siblings, 2 replies; 4+ messages in thread
From: Jeffrey Walton @ 2020-02-05  9:02 UTC (permalink / raw)
  To: bug-gnulib

Hi Everyone,

I'm building GetText 1.20.1 from sources on NetBSD. msgcmp is failing:

/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g2 -O2 -fPIC -pthread
 -L/usr/local/lib -Wl,-R,'$ORIGIN/../lib' -Wl,-R,/usr/local/lib
-Wl,--enable-new-dtags -o msgcmp msgcmp-msgcmp.o msgcmp-msgl-fsearch.o
libgettextsrc.la  -lm  -lpthread
libtool: link: gcc -g2 -O2 -fPIC -pthread -Wl,-R -Wl,\$ORIGIN/../lib
-Wl,-R -Wl,/usr/local/lib -Wl,--enable-new-dtags -o .libs/msgcmp
msgcmp-msgcmp.o msgcmp-msgl-fsearch.o  -L/usr/local/lib
./.libs/libgettextsrc.so
/home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so
/home/jwalton/gettext-0.20.1/libtextstyle/lib/.libs/libtextstyle.so
-lncurses /home/jwalton/gettext-0.20.1/gettext-tools/intl/.libs/libintl.so
-lc -lm -lpthread -pthread -Wl,-rpath -Wl,/usr/local/lib
/home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so:
undefined reference to `libiconv'
/home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so:
undefined reference to `libiconv_open'
/home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so:
undefined reference to `libiconv_close'
gmake[5]: *** [Makefile:2909: msgcmp] Error 1

I configured GetText with --with-libiconv-prefix=[DIR], but it looks
like -liconv and did not make it into the recipe. Adding -liconv to
LIBS did not help.

Jeff


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends)
  2020-02-05  9:02 GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends) Jeffrey Walton
@ 2020-02-05 12:39 ` Jeffrey Walton
  2020-02-05 14:48   ` Bruno Haible
  2020-02-05 14:53 ` Bruno Haible
  1 sibling, 1 reply; 4+ messages in thread
From: Jeffrey Walton @ 2020-02-05 12:39 UTC (permalink / raw)
  To: bug-gnulib

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

On Wed, Feb 5, 2020 at 4:02 AM Jeffrey Walton <noloader@gmail.com> wrote:
>
> Hi Everyone,
>
> I'm building GetText 1.20.1 from sources on NetBSD. msgcmp is failing:
>
> /bin/sh ../libtool  --tag=CC   --mode=link gcc  -g2 -O2 -fPIC -pthread
>  -L/usr/local/lib -Wl,-R,'$ORIGIN/../lib' -Wl,-R,/usr/local/lib
> -Wl,--enable-new-dtags -o msgcmp msgcmp-msgcmp.o msgcmp-msgl-fsearch.o
> libgettextsrc.la  -lm  -lpthread
> libtool: link: gcc -g2 -O2 -fPIC -pthread -Wl,-R -Wl,\$ORIGIN/../lib
> -Wl,-R -Wl,/usr/local/lib -Wl,--enable-new-dtags -o .libs/msgcmp
> msgcmp-msgcmp.o msgcmp-msgl-fsearch.o  -L/usr/local/lib
> ./.libs/libgettextsrc.so
> /home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so
> /home/jwalton/gettext-0.20.1/libtextstyle/lib/.libs/libtextstyle.so
> -lncurses /home/jwalton/gettext-0.20.1/gettext-tools/intl/.libs/libintl.so
> -lc -lm -lpthread -pthread -Wl,-rpath -Wl,/usr/local/lib
> /home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so:
> undefined reference to `libiconv'
> /home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so:
> undefined reference to `libiconv_open'
> /home/jwalton/gettext-0.20.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so:
> undefined reference to `libiconv_close'
> gmake[5]: *** [Makefile:2909: msgcmp] Error 1
>
> I configured GetText with --with-libiconv-prefix=[DIR], but it looks
> like -liconv and did not make it into the recipe. Adding -liconv to
> LIBS did not help.

It looks like the problems lie in .../gettext-tools/src/Makefile.in
and .../gettext-tools/gnulib-tests/Makefile.in. There were two
problems.

First, LTLIBICONV was empty in the makefiles. I had to manually:

    -LTLIBICONV = @LTLIBICONV@
    +LTLIBICONV = -liconv

Second, the recipes with the undefined references needed $(LTLIBICONV)
added to *_LDADD. So there were a lot of these:

    -test_localcharset_LDADD = $(LDADD)
    +test_localcharset_LDADD = $(LTLIBICONV) $(LDADD)

I guess the way to handle it is, if --with-libiconv-prefix then set
LTLIBICONV to -liconv; otherwise leave LTLIBICONV empty (or set it to
-lc).

Attached is the full patch for this problem.

Jeff

[-- Attachment #2: gettext-iconv.patch --]
[-- Type: text/x-patch, Size: 12682 bytes --]

--- gettext-tools/src/Makefile.in
+++ gettext-tools/src/Makefile.in
@@ -564,7 +564,7 @@
 	$(CFLAGS) $(cldr_plurals_LDFLAGS) $(LDFLAGS) -o $@
 am_hostname_OBJECTS = hostname-hostname.$(OBJEXT)
 hostname_OBJECTS = $(am_hostname_OBJECTS)
-hostname_LDADD = $(LDADD)
+hostname_LDADD = $(LTLIBICONV) $(LDADD)
 hostname_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(hostname_LDFLAGS) $(LDFLAGS) -o $@
@@ -666,14 +666,14 @@
 	recode_sr_latin-recode-sr-latin.$(OBJEXT) \
 	recode_sr_latin-filter-sr-latin.$(OBJEXT)
 recode_sr_latin_OBJECTS = $(am_recode_sr_latin_OBJECTS)
-recode_sr_latin_LDADD = $(LDADD)
+recode_sr_latin_LDADD = $(LTLIBICONV) $(LDADD)
 recode_sr_latin_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(AM_CFLAGS) $(CFLAGS) $(recode_sr_latin_LDFLAGS) $(LDFLAGS) \
 	-o $@
 am_urlget_OBJECTS = urlget-urlget.$(OBJEXT)
 urlget_OBJECTS = $(am_urlget_OBJECTS)
-urlget_LDADD = $(LDADD)
+urlget_LDADD = $(LTLIBICONV) $(LDADD)
 urlget_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(urlget_LDFLAGS) $(LDFLAGS) -o $@
@@ -1830,7 +1830,7 @@
 LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@
 LOCALE_ZH_CN = @LOCALE_ZH_CN@
 LOG10_LIBM = @LOG10_LIBM@
-LTLIBICONV = @LTLIBICONV@
+LTLIBICONV = -liconv
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
 LTLIBOBJS = @LTLIBOBJS@
@@ -2508,7 +2508,7 @@
 urlget_SOURCES = urlget.c
 cldr_plurals_SOURCES = cldr-plural.y cldr-plural-exp.c cldr-plurals.c
 cldr_plurals_CFLAGS = $(AM_CFLAGS) $(INCXML)
-cldr_plurals_LDADD = libgettextsrc.la $(LDADD)
+cldr_plurals_LDADD = libgettextsrc.la $(LTLIBICONV) $(LDADD)
 
 # How to build libgettextsrc.la.
 # Need ../gnulib-lib/libgettextlib.la.
@@ -2533,21 +2533,21 @@
 # INTL_MACOSX_LIBS is needed because the programs depend on libintl.la
 # but libtool doesn't put -Wl,-framework options into .la files.
 # For msginit, it is also needed because of localename.c.
-msgcmp_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(WOE32_LDADD)
-msgfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgmerge_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(WOE32_LDADD) $(OPENMP_CFLAGS)
-msgunfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-xgettext_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @LTLIBICONV@ $(WOE32_LDADD)
-msgattrib_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgcat_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgcomm_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgconv_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgen_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgexec_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msgfilter_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msggrep_LDADD = $(LIBGREP) libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msginit_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
-msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
+msgcmp_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(LTLIBICONV) $(WOE32_LDADD)
+msgfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgmerge_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(LTLIBICONV) $(WOE32_LDADD) $(OPENMP_CFLAGS)
+msgunfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+xgettext_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgattrib_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgcat_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgcomm_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgconv_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgen_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgexec_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msgfilter_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msggrep_LDADD = $(LIBGREP) libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msginit_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
+msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(LTLIBICONV) $(WOE32_LDADD)
 
 # Specify when to relink the programs.
 msgcmp_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
--- gettext-tools/gnulib-tests/Makefile.in
+++ gettext-tools/gnulib-tests/Makefile.in
@@ -954,7 +954,7 @@
 test_iconv_DEPENDENCIES = $(am__DEPENDENCIES_2)
 test_iconv_h_SOURCES = test-iconv-h.c
 test_iconv_h_OBJECTS = test-iconv-h.$(OBJEXT)
-test_iconv_h_LDADD = $(LDADD)
+test_iconv_h_LDADD = $(LTLIBICONV) $(LDADD)
 test_iconv_h_DEPENDENCIES = libtests.a ../gnulib-lib/libgettextlib.la \
 	libtests.a $(am__DEPENDENCIES_1)
 test_ignore_value_SOURCES = test-ignore-value.c
@@ -1039,13 +1039,13 @@
 test_listen_DEPENDENCIES = $(am__DEPENDENCIES_2)
 test_localcharset_SOURCES = test-localcharset.c
 test_localcharset_OBJECTS = test-localcharset.$(OBJEXT)
-test_localcharset_LDADD = $(LDADD)
+test_localcharset_LDADD = $(LTLIBICONV) $(LDADD)
 test_localcharset_DEPENDENCIES = libtests.a \
 	../gnulib-lib/libgettextlib.la libtests.a \
 	$(am__DEPENDENCIES_1)
 test_locale_SOURCES = test-locale.c
 test_locale_OBJECTS = test-locale.$(OBJEXT)
-test_locale_LDADD = $(LDADD)
+test_locale_LDADD = $(LTLIBICONV) $(LDADD)
 test_locale_DEPENDENCIES = libtests.a ../gnulib-lib/libgettextlib.la \
 	libtests.a $(am__DEPENDENCIES_1)
 test_localename_SOURCES = test-localename.c
@@ -3208,7 +3208,7 @@
 LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@
 LOCALE_ZH_CN = @LOCALE_ZH_CN@
 LOG10_LIBM = @LOG10_LIBM@
-LTLIBICONV = @LTLIBICONV@
+LTLIBICONV = -liconv
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
 LTLIBOBJS = @LTLIBOBJS@
@@ -3923,26 +3923,26 @@
 	wcrtomb.c wctob.c wctomb.c
 AM_LIBTOOLFLAGS = --preserve-dup-deps
 test_accept_LDADD = $(LDADD) @LIBSOCKET@
-test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@
-test_copy_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@
-test_sameacls_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@
-test_argmatch_LDADD = $(LDADD) @LIBINTL@
+test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LTLIBICONV)
+test_copy_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LTLIBICONV)
+test_sameacls_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LTLIBICONV)
+test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
 test_bind_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
 test_connect_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
-test_copy_file_LDADD = $(LDADD) $(LIB_ACL) $(LIB_CLOCK_GETTIME) @LIBINTL@
+test_copy_file_LDADD = $(LDADD) $(LIB_ACL) $(LIB_CLOCK_GETTIME) @LIBINTL@ $(LTLIBICONV)
 test_fabs_SOURCES = test-fabs.c randomd.c
 test_fabs_LDADD = $(LDADD) @FABS_LIBM@
 test_file_has_acl_LDADD = $(LDADD) $(LIB_HAS_ACL)
 test_fstrcmp_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
-test_getcwd_lgpl_LDADD = $(LDADD) $(LIBINTL)
-test_getopt_gnu_LDADD = $(LDADD) $(LIBINTL)
-test_getopt_posix_LDADD = $(LDADD) $(LIBINTL)
+test_getcwd_lgpl_LDADD = $(LDADD) $(LIBINTL) $(LTLIBICONV)
+test_getopt_gnu_LDADD = $(LDADD) $(LIBINTL) $(LTLIBICONV)
+test_getopt_posix_LDADD = $(LDADD) $(LIBINTL) $(LTLIBICONV)
 test_getprogname_LDADD = $(LDADD)
 GPERF = gperf
 V_GPERF = $(V_GPERF_@AM_V@)
 V_GPERF_ = $(V_GPERF_@AM_DEFAULT_V@)
 V_GPERF_0 = @echo "  GPERF   " $@;
-test_iconv_LDADD = $(LDADD) @LIBICONV@
+test_iconv_LDADD = $(LDADD) $(LTLIBICONV) 
 test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@
 test_isinf_LDADD = $(LDADD) @ISINF_LIBM@
 test_isnan_LDADD = $(LDADD) @ISNAN_LIBM@
@@ -3960,18 +3960,18 @@
 test_log10_SOURCES = test-log10.c randomd.c
 test_log10_LDADD = $(LDADD) @LOG10_LIBM@
 test_nanosleep_LDADD = $(LDADD) $(LIB_NANOSLEEP)
-test_pipe_filter_ii1_LDADD = $(LDADD) @LIBINTL@
-test_pipe_filter_ii2_main_LDADD = $(LDADD) @LIBINTL@
+test_pipe_filter_ii1_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
+test_pipe_filter_ii2_main_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
 test_pipe2_LDADD = $(LDADD) $(LIBSOCKET)
 test_pow_LDADD = $(LDADD) @POW_LIBM@
 test_pthread_sigmask1_LDADD = $(LDADD) @LIB_PTHREAD_SIGMASK@
 test_pthread_sigmask2_LDADD = $(LDADD) @LIB_PTHREAD_SIGMASK@ @LIBMULTITHREAD@
-test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@
+test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
 test_select_LDADD = $(LDADD) @LIB_SELECT@ @LIBSOCKET@ $(INET_PTON_LIB)
 test_select_fd_LDADD = $(LDADD) @LIB_SELECT@
 test_select_stdin_LDADD = $(LDADD) @LIB_SELECT@
 test_setsockopt_LDADD = $(LDADD) @LIBSOCKET@
-test_sh_quote_LDADD = $(LDADD) @LIBINTL@
+test_sh_quote_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
 
 # Because this Makefile snippet defines a variable used by other
 # gnulib Makefile snippets, it must be present in all makefiles that
@@ -3998,48 +3998,48 @@
 # need it. This is ensured by the applicability 'all' defined above.
 WARN_ON_USE_H = $(srcdir)/warn-on-use.h
 test_sockets_LDADD = $(LDADD) @LIBSOCKET@
-test_spawn_pipe_main_LDADD = $(LDADD) @LIBINTL@
+test_spawn_pipe_main_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
 # The test-spawn-pipe-child program must be a real executable, not a libtool
 # wrapper script, and should link against as few libraries as possible.
 # Therefore don't link it against any libraries other than -lc.
 test_spawn_pipe_child_LDADD = 
-test_stat_LDADD = $(LDADD) $(LIBINTL)
+test_stat_LDADD = $(LDADD) $(LIBINTL) $(LTLIBICONV)
 test_stat_time_LDADD = $(LDADD) $(LIB_NANOSLEEP)
-test_striconv_LDADD = $(LDADD) @LIBICONV@
-test_striconveh_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
+test_striconv_LDADD = $(LDADD) $(LTLIBICONV)
+test_striconveh_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_striconveha_SOURCES = test-striconveha.c iconvsupport.c
-test_striconveha_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
+test_striconveha_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_thread_self_LDADD = $(LDADD) @LIBTHREAD@
 test_thread_create_LDADD = $(LDADD) @LIBMULTITHREAD@
 test_tls_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@
 test_u8_conv_from_enc_SOURCES = uniconv/test-u8-conv-from-enc.c iconvsupport.c
-test_u8_conv_from_enc_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@
+test_u8_conv_from_enc_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_ctype_space_SOURCES = unictype/test-ctype_space.c
-test_ctype_space_LDADD = $(LDADD) $(LIBUNISTRING)
+test_ctype_space_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_width_linebreaks_SOURCES = unilbrk/test-u8-width-linebreaks.c
-test_u8_width_linebreaks_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_width_linebreaks_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 @LIBUNISTRING_COMPILE_UNINAME_UNINAME_TRUE@test_uninames_SOURCES = uniname/test-uninames.c
 @LIBUNISTRING_COMPILE_UNINAME_UNINAME_TRUE@test_uninames_LDADD = $(LDADD) @LIBINTL@
 test_u16_mbtouc_SOURCES = unistr/test-u16-mbtouc.c
-test_u16_mbtouc_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u16_mbtouc_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_check_SOURCES = unistr/test-u8-check.c
-test_u8_check_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_check_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_cmp_SOURCES = unistr/test-u8-cmp.c
-test_u8_cmp_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_cmp_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_mblen_SOURCES = unistr/test-u8-mblen.c
-test_u8_mblen_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_mblen_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c
-test_u8_mbtoucr_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_mbtoucr_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_prev_SOURCES = unistr/test-u8-prev.c
-test_u8_prev_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_prev_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_strlen_SOURCES = unistr/test-u8-strlen.c
-test_u8_strlen_LDADD = $(LDADD) $(LIBUNISTRING)
+test_u8_strlen_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
 test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c
-test_u8_uctomb_LDADD = $(LDADD) $(LIBUNISTRING)
-test_wcwidth_LDADD = $(LDADD) $(LIBUNISTRING)
-test_xalloc_die_LDADD = $(LDADD) @LIBINTL@
-test_xmemdup0_LDADD = $(LDADD) @LIBINTL@
-test_xvasprintf_LDADD = $(LDADD) @LIBINTL@
+test_u8_uctomb_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
+test_wcwidth_LDADD = $(LDADD) $(LIBUNISTRING) $(LTLIBICONV)
+test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
+test_xmemdup0_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
+test_xvasprintf_LDADD = $(LDADD) @LIBINTL@ $(LTLIBICONV)
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends)
  2020-02-05 12:39 ` Jeffrey Walton
@ 2020-02-05 14:48   ` Bruno Haible
  0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2020-02-05 14:48 UTC (permalink / raw)
  To: bug-gnulib, noloader

Hi Jeffrey,

> Attached is the full patch for this problem.

It is pointless to patch Makefile.in files, since these are generated from
Makefile.am files.

> First, LTLIBICONV was empty in the makefiles. I had to manually:
> 
>     -LTLIBICONV = @LTLIBICONV@
>     +LTLIBICONV = -liconv

On NetBSD, which has iconv() in libc, it is normal that LIBICONV and
LTLIBICONV are set to empty.

However, if you are using GNU libiconv's <iconv.h>, LIBICONV and
LTLIBICONV need to contain "-L<path> -liconv -Wl,-rpath,-<path>".
If not, you need to take a look in config.log, to determine why not.

> Second, the recipes with the undefined references needed $(LTLIBICONV)
> added to *_LDADD. So there were a lot of these:
> 
>     -test_localcharset_LDADD = $(LDADD)
>     +test_localcharset_LDADD = $(LTLIBICONV) $(LDADD)

gnulib/modules/localcharset-tests does not reference $(LIBICONV), because
the test code test-localcharset.c does not make use of iconv(). How come
that you get a link error for test-localcharset?

Bruno



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends)
  2020-02-05  9:02 GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends) Jeffrey Walton
  2020-02-05 12:39 ` Jeffrey Walton
@ 2020-02-05 14:53 ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2020-02-05 14:53 UTC (permalink / raw)
  To: bug-gnulib, noloader

Jeffrey Walton wrote:
> /bin/sh ../libtool  --tag=CC   --mode=link gcc  -g2 -O2 -fPIC -pthread
>  -L/usr/local/lib -Wl,-R,'$ORIGIN/../lib' -Wl,-R,/usr/local/lib
> -Wl,--enable-new-dtags

Did you specify -Wl,--enable-new-dtags, or did it come out of libtool?

Does the NetBSD dynamic loader support DT_RUNPATH? [1] says that the option
--enable-new-dtags is meant for GNU systems.

Bruno

[1] https://en.wikipedia.org/wiki/Rpath



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-05 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  9:02 GetText 1.20.1 and libgettextlib.so: undefined reference to `libiconv' (and friends) Jeffrey Walton
2020-02-05 12:39 ` Jeffrey Walton
2020-02-05 14:48   ` Bruno Haible
2020-02-05 14:53 ` Bruno Haible

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).