My fault - I had a bad copy of libc-lock.h in /usr/local/include. No idea what it was doing there. Using the modified glibc-2.0.5 libc-lock.h which includes #pragma weak the problem is fixed.