When building a testdir with --enable-threads=pth --with-libpth-prefix=... I see link errors:
gcc -g -O2 -o test-fstrcmp test-fstrcmp.o libtests.a ../gllib/libgnu.a libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_init_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:518: undefined reference to `pth_cond_init' /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:520: undefined reference to `pth_cond_init' ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_rdlock_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:543: undefined reference to `pth_cond_await' ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_wrlock_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:567: undefined reference to `pth_cond_await' ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_unlock_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:616: undefined reference to `pth_cond_notify' /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:626: undefined reference to `pth_cond_notify' collect2: error: ld returned 1 exit status Makefile:14436: recipe for target 'test-fstrcmp' failed make[3]: *** [test-fstrcmp] Error 1 gcc -g -O2 -o test-once1 test-once.o libtests.a ../gllib/libgnu.a libtests.a -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_init_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:518: undefined reference to `pth_cond_init' /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:520: undefined reference to `pth_cond_init' ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_rdlock_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:543: undefined reference to `pth_cond_await' ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_wrlock_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:567: undefined reference to `pth_cond_await' ../gllib/libgnu.a(lock.o): In function `glthread_rwlock_unlock_multithreaded': /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:616: undefined reference to `pth_cond_notify' /media/develdata/devel/GNULIB/testdir-all/build-pth/gllib/../../gllib/glthread/lock.c:626: undefined reference to `pth_cond_notify' collect2: error: ld returned 1 exit status Makefile:15438: recipe for target 'test-once1' failed make[3]: *** [test-once1] Error 1 This patch fixes them. Will push soon. 2019-01-04 Bruno Haible <br...@clisp.org> lock: Fix link error with --enable-threads=pth. * lib/glthread/lock.h (pth_cond_init, pth_cond_await, pth_cond_notify): Mark as weak. diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h index c0fa53e..6e1fdf8 100644 --- a/lib/glthread/lock.h +++ b/lib/glthread/lock.h @@ -416,6 +416,9 @@ extern "C" { # pragma weak pth_rwlock_acquire # pragma weak pth_rwlock_release # pragma weak pth_once +# pragma weak pth_cond_init +# pragma weak pth_cond_await +# pragma weak pth_cond_notify # pragma weak pth_cancel # define pth_in_use() (pth_cancel != NULL)