On a machine with libunistring installed, a gnulib-testdir fails to compile like this:
gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isalnum test-c32isalnum.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_alnum ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14511: test-c32isalnum] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isalpha test-c32isalpha.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_alpha ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14515: test-c32isalpha] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isblank test-c32isblank.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_blank ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14519: test-c32isblank] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32iscntrl test-c32iscntrl.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_cntrl ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14523: test-c32iscntrl] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isdigit test-c32isdigit.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_digit ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14527: test-c32isdigit] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isgraph test-c32isgraph.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_graph ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14531: test-c32isgraph] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32islower test-c32islower.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_lower ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14535: test-c32islower] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isprint test-c32isprint.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_print ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14539: test-c32isprint] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32ispunct test-c32ispunct.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_punct ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14543: test-c32ispunct] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isspace test-c32isspace.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_space ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14547: test-c32isspace] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isupper test-c32isupper.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_upper ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14551: test-c32isupper] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-c32isxdigit test-c32isxdigit.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -pthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_xdigit ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:14555: test-c32isxdigit] Error 1 gcc -maix64 -g -O2 -L/home/haible/prefix64/lib -o test-unicodeio test-unicodeio.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -pthread -liconv -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .u8_uctomb_aux ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: error: ld returned 8 exit status gmake[4]: *** [Makefile:19771: test-unicodeio] Error 1 The reason is that when libunistring is installed and found, modules that duplicate libunistring functionality (e.g. those that define 'uc_is_alnum' etc.) are not being built. This patch should fix it. 2020-11-16 Bruno Haible <br...@clisp.org> Fix link errors on platforms with libunistring. * modules/c32isalnum (Link): New section. * modules/c32isalnum-tests (Makefile.am): Link test-c32isalnum with $(LIBUNISTRING). * modules/c32isalpha (Link): New section. * modules/c32isalpha-tests (Makefile.am): Link test-c32isalpha with $(LIBUNISTRING). * modules/c32isblank (Link): New section. * modules/c32isblank-tests (Makefile.am): Link test-c32isblank with $(LIBUNISTRING). * modules/c32iscntrl (Link): New section. * modules/c32iscntrl-tests (Makefile.am): Link test-c32iscntrl with $(LIBUNISTRING). * modules/c32isdigit (Link): New section. * modules/c32isdigit-tests (Makefile.am): Link test-c32isdigit with $(LIBUNISTRING). * modules/c32isgraph (Link): New section. * modules/c32isgraph-tests (Makefile.am): Link test-c32isgraph with $(LIBUNISTRING). * modules/c32islower (Link): New section. * modules/c32islower-tests (Makefile.am): Link test-c32islower with $(LIBUNISTRING). * modules/c32isprint (Link): New section. * modules/c32isprint-tests (Makefile.am): Link test-c32isprint with $(LIBUNISTRING). * modules/c32ispunct (Link): New section. * modules/c32ispunct-tests (Makefile.am): Link test-c32ispunct with $(LIBUNISTRING). * modules/c32isspace (Link): New section. * modules/c32isspace-tests (Makefile.am): Link test-c32isspace with $(LIBUNISTRING). * modules/c32isupper (Link): New section. * modules/c32isupper-tests (Makefile.am): Link test-c32isupper with $(LIBUNISTRING). * modules/c32isxdigit (Link): New section. * modules/c32isxdigit-tests (Makefile.am): Link test-c32isxdigit with $(LIBUNISTRING). * modules/unicodeio (Link): Mention $(LIBUNISTRING). * modules/unicodeio-tests (Makefile.am): Link test-unicodeio with $(LIBUNISTRING). diff --git a/modules/c32isalnum b/modules/c32isalnum index 213ffdd..1935655 100644 --- a/modules/c32isalnum +++ b/modules/c32isalnum @@ -26,6 +26,9 @@ lib_SOURCES += c32isalnum.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isalnum-tests b/modules/c32isalnum-tests index 51e3ac4..54ef82c 100644 --- a/modules/c32isalnum-tests +++ b/modules/c32isalnum-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isalnum -test_c32isalnum_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isalnum_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isalpha b/modules/c32isalpha index 1ca598d..c4b831e 100644 --- a/modules/c32isalpha +++ b/modules/c32isalpha @@ -26,6 +26,9 @@ lib_SOURCES += c32isalpha.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isalpha-tests b/modules/c32isalpha-tests index 4c4ebaa..1e4c77b 100644 --- a/modules/c32isalpha-tests +++ b/modules/c32isalpha-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isalpha -test_c32isalpha_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isalpha_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isblank b/modules/c32isblank index eff925a..3c99311 100644 --- a/modules/c32isblank +++ b/modules/c32isblank @@ -27,6 +27,9 @@ lib_SOURCES += c32isblank.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isblank-tests b/modules/c32isblank-tests index 8f48be3..9efdda4 100644 --- a/modules/c32isblank-tests +++ b/modules/c32isblank-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isblank -test_c32isblank_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isblank_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32iscntrl b/modules/c32iscntrl index 4fb6484..74f571d 100644 --- a/modules/c32iscntrl +++ b/modules/c32iscntrl @@ -26,6 +26,9 @@ lib_SOURCES += c32iscntrl.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32iscntrl-tests b/modules/c32iscntrl-tests index b170e7c..d927f33 100644 --- a/modules/c32iscntrl-tests +++ b/modules/c32iscntrl-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32iscntrl -test_c32iscntrl_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32iscntrl_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isdigit b/modules/c32isdigit index 3e31fdb..bb1cae5 100644 --- a/modules/c32isdigit +++ b/modules/c32isdigit @@ -27,6 +27,9 @@ lib_SOURCES += c32isdigit.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isdigit-tests b/modules/c32isdigit-tests index ccb74f3..b300e11 100644 --- a/modules/c32isdigit-tests +++ b/modules/c32isdigit-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isdigit -test_c32isdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isgraph b/modules/c32isgraph index 9c14ab0..dd967ca 100644 --- a/modules/c32isgraph +++ b/modules/c32isgraph @@ -26,6 +26,9 @@ lib_SOURCES += c32isgraph.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isgraph-tests b/modules/c32isgraph-tests index 0cb7321..a1badde 100644 --- a/modules/c32isgraph-tests +++ b/modules/c32isgraph-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isgraph -test_c32isgraph_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isgraph_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32islower b/modules/c32islower index 475f51d..b8949ae 100644 --- a/modules/c32islower +++ b/modules/c32islower @@ -26,6 +26,9 @@ lib_SOURCES += c32islower.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32islower-tests b/modules/c32islower-tests index bf52816..5a6010f 100644 --- a/modules/c32islower-tests +++ b/modules/c32islower-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32islower -test_c32islower_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32islower_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isprint b/modules/c32isprint index b95a8c5..9badd0b 100644 --- a/modules/c32isprint +++ b/modules/c32isprint @@ -26,6 +26,9 @@ lib_SOURCES += c32isprint.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isprint-tests b/modules/c32isprint-tests index ea7abd6..5c804f2 100644 --- a/modules/c32isprint-tests +++ b/modules/c32isprint-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isprint -test_c32isprint_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isprint_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32ispunct b/modules/c32ispunct index 2f5e0e4..72373c8 100644 --- a/modules/c32ispunct +++ b/modules/c32ispunct @@ -27,6 +27,9 @@ lib_SOURCES += c32ispunct.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32ispunct-tests b/modules/c32ispunct-tests index 2e1ee95..396d1ca4 100644 --- a/modules/c32ispunct-tests +++ b/modules/c32ispunct-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32ispunct -test_c32ispunct_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32ispunct_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isspace b/modules/c32isspace index e42658b..2974e20 100644 --- a/modules/c32isspace +++ b/modules/c32isspace @@ -26,6 +26,9 @@ lib_SOURCES += c32isspace.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isspace-tests b/modules/c32isspace-tests index a37b528..aef1272 100644 --- a/modules/c32isspace-tests +++ b/modules/c32isspace-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isspace -test_c32isspace_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isspace_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isupper b/modules/c32isupper index 05ea0f4..e10c58a 100644 --- a/modules/c32isupper +++ b/modules/c32isupper @@ -26,6 +26,9 @@ lib_SOURCES += c32isupper.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isupper-tests b/modules/c32isupper-tests index 0410e9d..beeb3a9 100644 --- a/modules/c32isupper-tests +++ b/modules/c32isupper-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isupper -test_c32isupper_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isupper_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/c32isxdigit b/modules/c32isxdigit index 4572deb..127155c 100644 --- a/modules/c32isxdigit +++ b/modules/c32isxdigit @@ -28,6 +28,9 @@ lib_SOURCES += c32isxdigit.c Include: <uchar.h> +Link: +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise + License: LGPLv3+ or GPLv2 diff --git a/modules/c32isxdigit-tests b/modules/c32isxdigit-tests index 9b23f07..b086040 100644 --- a/modules/c32isxdigit-tests +++ b/modules/c32isxdigit-tests @@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-c32isxdigit -test_c32isxdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) +test_c32isxdigit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) $(LIBUNISTRING) diff --git a/modules/unicodeio b/modules/unicodeio index d7a3a4a..b1b077d 100644 --- a/modules/unicodeio +++ b/modules/unicodeio @@ -27,6 +27,7 @@ Include: Link: $(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise +$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise License: GPL diff --git a/modules/unicodeio-tests b/modules/unicodeio-tests index aa5803c..c53f26f 100644 --- a/modules/unicodeio-tests +++ b/modules/unicodeio-tests @@ -18,4 +18,4 @@ gt_LOCALE_ZH_CN Makefile.am: TESTS += test-unicodeio1.sh test-unicodeio2.sh test-unicodeio3.sh check_PROGRAMS += test-unicodeio -test_unicodeio_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBICONV) $(LIBINTL) +test_unicodeio_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) $(LIBICONV) $(LIBINTL)