On AIX, with --enable-threads=isoc+posix, I'm seeing this link error: xlc -q64 -qthreaded -qtls -g -L/home/haible/prefix64/lib -o test-thread_self test-thread_self.o libtests.a ../gllib/libgnu.a libtests.a ld: 0711-317 ERROR: Undefined symbol: .pthread_self ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. gmake[4]: *** [test-thread_self] Error 8
The test's expectation is not justified: since gl_thread_self(), in this case, is based on pthread_self() - since that's the only way to make it interoperate with pthread_join() -, use of gl_thread_self() requires linking with $(LIBMULTITHREAD), not $(LIBTHREAD). The test was written for glibc systems and is not universally valid. 2019-12-02 Bruno Haible <[email protected]> thread tests: Avoid link error with --enable-threads=isoc+posix on AIX. * tests/test-thread_self.c (main): Disable test on AIX. diff --git a/tests/test-thread_self.c b/tests/test-thread_self.c index 8fb00a1..0d48ddc 100644 --- a/tests/test-thread_self.c +++ b/tests/test-thread_self.c @@ -28,7 +28,12 @@ main () /* Check that gl_thread_self () can be used with just $(LIBTHREAD), not $(LIBMULTITHREAD), i.e. in libraries that are multithread-safe but don't create threads themselves. */ + /* This is not the case on AIX with --enable-threads=isoc+posix, because in + this case, $(LIBTHREAD) is empty whereas $(LIBMULTITHREAD) is '-lpthread'. + */ +#if !defined _AIX main_thread = gl_thread_self (); +#endif return 0; }
