On 30.05.2013 23:49, Julian Taylor wrote: > On 30.05.2013 23:43, Vincent Bernat wrote: >> ❦ 30 mai 2013 14:17 CEST, Julian Taylor <jtaylor.deb...@googlemail.com> : >> >>> stud fails to build with ld --as-needed. >>> With --as-needed libraries need to be placed before objects needing >>> their symbols. >>> >>> Attached patch fixes the issue. >> >> Hi Julian! >> >> Thanks for the patch. I am concerned about the part on libebtree: >> > > right, the whole ebtree part of the patch is unnecessary. > Sorry, I didn't check the patch properly before forwarding it. >
I overlooked another issue in the non x86 arches :/ you are adding -lpthread to LDFLAGS on those arches which does not work. Instead you should use -pthread, it in addition to linking lpthreads it also sets some macros like -D_REENTRANT and it works from LDFLAGS with --as-needed. see attached patch.
Description: pass -pthread to gcc instead of lpthread -pthread sets some macros and works from LDFLAGS with ld --as-needed Author: Julian Taylor <jtay...@ubuntu.com> --- a/Makefile +++ b/Makefile @@ -30,7 +30,8 @@ ifeq ($(DEB_HOST_ARCH),amd64) CFLAGS += -DUSE_SYSCALL_FUTEX else #we are on neither i396 or amd64, we need to link the pthread library -LDFLAGS += -lpthread +LDFLAGS += -pthread +CFLAGS += -pthread endif endif