[ I'm Cc:ing Julian Elischer, who is one of the FreeBSD experts on threading. Julian, at http://www.winehq.org/hypermail/wine-devel/2003/08/0401.html you'll find the original three messages on this. ]
On Wed, 20 Aug 2003, Alexandre Julliard wrote:
Wine fails to build on FreeBSD 4.8 with the following failure mode:
/usr/bin/gcc -c -I. -I. -I../../include -I../../include -I/usr/X11R6/include -D_REENTRANT -fPIC -D__WINESRC__ -Wall -mpreferred-stack-boundary=2 -fno-strict-aliasing -gstabs+ -Wpointer-arith -g -O2 -o glu32.spec.o glu32.spec.c /usr/bin/gcc -shared -Wl,-Bsymbolic,-z,defs glu32.spec.o glu.o glu32.dll.dbg.o -o glu32.dll.so -L../../dlls -L../../libs/wine -lwine -L/usr/X11R6/lib -lSM -lICE -lXxf86dga -lXxf86vm -lXv -lXext -lX11 -lGL -lGLU -lpthread -L../../libs/port -lwine_port -lm -lc /usr/libexec/elf/ld: cannot find -lpthread
So what's the right way to link with libpthread on FreeBSD?
Wine builds fine if I just omit the -lpthread line above.
man pthread, however, notes the following (both FreeBSD 4.8 and 5.1):
The current FreeBSD POSIX thread implementation is built in the library libc_r which contains both thread-safe libc functions and the thread functions. This library replaces libc for threaded applications.
A FreeBSD specific option has been added to gcc to make linking threaded processes simple. gcc -pthread links a threaded process against libc_r instead of libc.
So perhaps we ought to use -lc_r instead of -lc and omit -lpthread on FreeBSD (or use -pthread)?
Gerald