'make regtest' on trunk currently fails on Ubuntu 16.04/s390x. gcc -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -m64 -lpthread -o ex_clone ex_clone.o ex_clone.o: In function `main': /home/ubuntu/valgrind/none/tests/s390x/ex_clone.c:42: undefined reference to `pthread_create' /home/ubuntu/valgrind/none/tests/s390x/ex_clone.c:57: undefined reference to `pthread_join' collect2: error: ld returned 1 exit status Makefile:1324: recipe for target 'ex_clone' failed Reproducible: Always Steps to Reproduce: 1. Install Ubuntu 16.04 on an s390x system 2. svn clone svn://svn.valgrind.org/valgrind/trunk valgrind 3. cd valgrind; ./autogen.sh; ./configure; make regtest Actual Results: gcc -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -m64 -lpthread -o ex_clone ex_clone.o ex_clone.o: In function `main': /home/ubuntu/valgrind/none/tests/s390x/ex_clone.c:42: undefined reference to `pthread_create' /home/ubuntu/valgrind/none/tests/s390x/ex_clone.c:57: undefined reference to `pthread_join' collect2: error: ld returned 1 exit status Makefile:1324: recipe for target 'ex_clone' failed Expected Results: Successful build.
Created attachment 98183 [details] Move -lpthread to end of linker command line
I can certaiinly apply this patch, but I am puzzled. why does gcc -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -m64 -o ex_clone none/tests/s390x/ex_clone.o -lpthread work and gcc -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -m64 -lpthread -o ex_clone none/tests/s390x/ex_clone.o does not?
OK, seems that library ordering does indeed matter. applied as r15970