On AIX 7.1 with xlc, building a testdir of all of gnulib produces link errors:
xlC -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-fnmatch-h-c++ test-fnmatch-h-c++.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. (continuing) xlC -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-glob-h-c++ test-glob-h-c++.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a /home/haible/prefix64/lib/libintl.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. (continuing) xlC -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-stdlib-c++ test-stdlib-c++.o test-stdlib-c++2.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a /home/haible/prefix64/lib/libintl.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .perfstat_cpu_total ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. (continuing) xlC -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-sys_stat-c++ test-sys_stat-c++.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a /home/haible/prefix64/lib/libintl.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_init ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_wait ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_signal ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_broadcast ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_destroy ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_init ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_settype ld: 0711-317 ERROR: Undefined symbol: .pthread_mutexattr_destroy ld: 0711-317 ERROR: Undefined symbol: .pthread_once ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. (continuing) xlC -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-uchar-c++ test-uchar-c++.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -lpthread -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ld: 0711-317 ERROR: Undefined symbol: .uc_is_xdigit ld: 0711-317 ERROR: Undefined symbol: .uc_is_upper ld: 0711-317 ERROR: Undefined symbol: .uc_is_space ld: 0711-317 ERROR: Undefined symbol: .uc_is_punct ld: 0711-317 ERROR: Undefined symbol: .uc_is_print ld: 0711-317 ERROR: Undefined symbol: .uc_is_lower ld: 0711-317 ERROR: Undefined symbol: .uc_is_graph ld: 0711-317 ERROR: Undefined symbol: .uc_is_digit ld: 0711-317 ERROR: Undefined symbol: .uc_is_cntrl ld: 0711-317 ERROR: Undefined symbol: .uc_is_blank ld: 0711-317 ERROR: Undefined symbol: .uc_is_alpha ld: 0711-317 ERROR: Undefined symbol: .uc_is_alnum ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. make: 1254-004 The error code from the last command is 8. (continuing) This patch should fix it. 2021-12-24 Bruno Haible <br...@clisp.org> tests: Fix link errors on AIX. * modules/fnmatch-h-c++-tests (Makefile.am): Link test-fnmatch-h-c++ with $(LIB_MBRTOWC). * modules/glob-h-c++-tests (Makefile.am): Link test-glob-h-c++ with $(LIB_MBRTOWC). * modules/stdlib-c++-tests (Makefile.am): Link test-stdlib-c++ with $(GETLOADAVG_LIBS). * modules/sys_stat-c++-tests (Makefile.am): Link test-sys_stat-c++ with $(LIB_MBRTOWC). * modules/uchar-c++-tests (Makefile.am): Link test-uchar-c++ with $(LIBUNISTRING). diff --git a/modules/fnmatch-h-c++-tests b/modules/fnmatch-h-c++-tests index 3aed07929..abae06d99 100644 --- a/modules/fnmatch-h-c++-tests +++ b/modules/fnmatch-h-c++-tests @@ -15,4 +15,5 @@ if ANSICXX TESTS += test-fnmatch-h-c++ check_PROGRAMS += test-fnmatch-h-c++ test_fnmatch_h_c___SOURCES = test-fnmatch-h-c++.cc +test_fnmatch_h_c___LDADD = $(LDADD) $(LIB_MBRTOWC) endif diff --git a/modules/glob-h-c++-tests b/modules/glob-h-c++-tests index de42019ea..4ae96408e 100644 --- a/modules/glob-h-c++-tests +++ b/modules/glob-h-c++-tests @@ -15,5 +15,5 @@ if ANSICXX TESTS += test-glob-h-c++ check_PROGRAMS += test-glob-h-c++ test_glob_h_c___SOURCES = test-glob-h-c++.cc -test_glob_h_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME) +test_glob_h_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME) $(LIB_MBRTOWC) endif diff --git a/modules/stdlib-c++-tests b/modules/stdlib-c++-tests index 1089c46ee..465ebfeda 100644 --- a/modules/stdlib-c++-tests +++ b/modules/stdlib-c++-tests @@ -16,5 +16,5 @@ if ANSICXX TESTS += test-stdlib-c++ check_PROGRAMS += test-stdlib-c++ test_stdlib_c___SOURCES = test-stdlib-c++.cc test-stdlib-c++2.cc -test_stdlib_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_GETRANDOM) +test_stdlib_c___LDADD = $(LDADD) $(LIBINTL) $(GETLOADAVG_LIBS) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_GETRANDOM) endif diff --git a/modules/sys_stat-c++-tests b/modules/sys_stat-c++-tests index 03f0048f8..576ef0701 100644 --- a/modules/sys_stat-c++-tests +++ b/modules/sys_stat-c++-tests @@ -15,5 +15,5 @@ if ANSICXX TESTS += test-sys_stat-c++ check_PROGRAMS += test-sys_stat-c++ test_sys_stat_c___SOURCES = test-sys_stat-c++.cc -test_sys_stat_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME) +test_sys_stat_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME) $(LIB_MBRTOWC) endif diff --git a/modules/uchar-c++-tests b/modules/uchar-c++-tests index 2cbc3312b..7ff4e1bf2 100644 --- a/modules/uchar-c++-tests +++ b/modules/uchar-c++-tests @@ -39,5 +39,5 @@ test_uchar_c___SOURCES = test-uchar-c++.cc if CXX_HAVE_CUCHAR test_uchar_c___SOURCES += test-uchar-c++2.cc endif -test_uchar_c___LDADD = $(LDADD) $(LIB_MBRTOWC) +test_uchar_c___LDADD = $(LDADD) $(LIBUNISTRING) $(LIB_MBRTOWC) endif