gcc 2.95.2 and pthreads on FreeBSD 3.4

Jonathan Wilkins jwilkins@madscience.nu
Sat Mar 18 20:43:00 GMT 2000


I just installed gcc 2.95.2 through the ports system on a FreeBSD 3.4
machine.  I then changed the Makefile for an application I am working on
to refer to gcc295 instead of gcc.

When I try to build the app, it compiles fine, but complains at the link
phase as follows:

gcc295 -g -pg -pthread -O  [FILES].o -lpcap -o [TARGET]
utils.o: In function `my_read':
/home/jwilkins/[app]/utils.c:288: undefined reference to
`__pthread_read'
utils.o: In function `writen':
/home/jwilkins/[app]/utils.c:346: undefined reference to
`__pthread_write'
utils.o: In function `readn':
/home/jwilkins/[app]/utils.c:376: undefined reference to
`__pthread_read'
jwsniff.o: In function `main':
/home/jwilkins/[app]/jw.c:87: undefined reference to `__pthread_accept'
collect2: ld returned 1 exit status
*** Error code 1

If I remove the -pthread option and use -lpthread instead, everything
resolves, but I get a bus error on execution... 

It seems to be some sort of naming problem, as pthread_create is found.. 

Suggestions would be much appreciated.. 

Thanks
  Jonathan


More information about the Gcc mailing list