[SOLVED] Re: Linking to pthread library: undefined reference

Frank Behrens frank at pinky.sax.de
Sun Jun 17 10:18:26 UTC 2007


Frank Behrens <frank at pinky.sax.de> wrote on 15 Jun 2007 19:01:
>....
> In my Makefile I have:
> CFLAGS+=	-I/usr/local/include -std=c99 -pthread -v
> LDADD+=		-L/usr/local/lib -lmilter
>...
> /usr/lib/libmilter.so: undefined reference to `pthread_detach'

Please excuse for the noise, the problem has been solved. To avoid that others fall into the 
trap here is the reason:

Long, long time ago I tested an application, that needed an pthread-semaphore library. This 
library installed a file named "/usr/local/lib/libpthread.so.20". You know what then happened.

The lesson I learned: 
If you have trouble with the linker use always "ld -Vt" to see whats going on really.

Regards,
   Frank



More information about the freebsd-threads mailing list