Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2001 18:17:31 -0500
From:      Jim Bryant <kc5vdj@yahoo.com>
To:        dpetrou@cs.cmu.edu
Cc:        Mikko Tyolajarvi <mikko@dynas.se>, freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: wacky warnings linking multithreaded code
Message-ID:  <3B858F0B.5050300@yahoo.com>
References:  <20010823150044.E24447@amant.pdl.cs.cmu.edu> <200108232105.f7NL50119378@mikko.dynas.se> <20010823171156.G24447@amant.pdl.cs.cmu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
if you have the linux-pthreads port installed, remove it.  things will compile properly afterwards.

linux-pthreads really needs a different library name and include file names...

i lay odds that this known conflict is your problem.

David Petrou wrote:

>>cc -pthread test.c
>>
> 
> i tried that too.  that works for test.c, which doesn't reference
> anything, but in more complex programs, it dies.  i wish i knew why.
> check this out:
> 
> this is the command to link testgthread from the glib library without
> -lc_r and without -pthread:
> ----------------------------------------------------------------------
> amant 1/619 cs.cmu.edu/project/pdl-19/glib-1.2.10/gthread> gmake
> /bin/sh ../libtool --mode=link gcc  -g -O2 -Wall -D_THREAD_SAFE -D_REENTRANT  -o testgthread  testgthread.o ../libglib.la libgthread.la 
> gcc -g -O2 -Wall -D_THREAD_SAFE -D_REENTRANT -o .libs/testgthread testgthread.o ../.libs/libglib.so .libs/libgthread.so -Wl,--rpath -Wl,/usr/local/lib
> testgthread.o: In function `new_thread':
> /afs/cs.cmu.edu/project/pdl-19/glib-1.2.10/gthread/testgthread.c(.text+0x3227): undefined reference to `pthread_attr_init'
> /afs/cs.cmu.edu/project/pdl-19/glib-1.2.10/gthread/testgthread.c(.text+0x3233): undefined reference to `pthread_create'
> testgthread.o: In function `private_constructor':
> /afs/cs.cmu.edu/project/pdl-19/glib-1.2.10/gthread/testgthread.c:139: undefined reference to `pthread_self'
> testgthread.o: In function `test_private':
> /afs/cs.cmu.edu/project/pdl-19/glib-1.2.10/gthread/testgthread.c(.text+0x3511): undefined reference to `pthread_join'
> .libs/libgthread.so: undefined reference to `pthread_cond_signal'
> .libs/libgthread.so: undefined reference to `pthread_getspecific'
> .libs/libgthread.so: undefined reference to `pthread_cond_broadcast'
> .libs/libgthread.so: undefined reference to `pthread_key_create'
> .libs/libgthread.so: undefined reference to `pthread_cond_init'
> .libs/libgthread.so: undefined reference to `pthread_mutex_unlock'
> .libs/libgthread.so: undefined reference to `pthread_mutex_destroy'
> .libs/libgthread.so: undefined reference to `pthread_mutex_lock'
> .libs/libgthread.so: undefined reference to `pthread_cond_wait'
> .libs/libgthread.so: undefined reference to `pthread_mutex_trylock'
> .libs/libgthread.so: undefined reference to `pthread_cond_destroy'
> .libs/libgthread.so: undefined reference to `pthread_mutex_init'
> .libs/libgthread.so: undefined reference to `pthread_cond_timedwait'
> .libs/libgthread.so: undefined reference to `pthread_setspecific'
> gmake: *** [testgthread] Error 1
> ----------------------------------------------------------------------
> 
> now with -pthread:
> ----------------------------------------------------------------------
> amant 1/621 cs.cmu.edu/project/pdl-19/glib-1.2.10/gthread> /bin/sh ../libtool --mode=link gcc -g -O2 -Wall -D_THREAD_SAFE -D_REENTRANT -o testgthread testgthread.o ../libglib.la libgthread.la -pthread
> gcc -g -O2 -Wall -D_THREAD_SAFE -D_REENTRANT -o .libs/testgthread testgthread.o ../.libs/libglib.so .libs/libgthread.so -pthread -Wl,--rpath -Wl,/usr/local/lib
> /usr/lib/libc.so.4: WARNING!  setkey(3) not present in the system!
> /usr/lib/libc.so.4: warning: this program uses gets(), which is unsafe.
> /usr/lib/libc.so.4: warning: mktemp() possibly used unsafely; consider using mkstemp()
> /usr/lib/libc.so.4: WARNING!  des_setkey(3) not present in the system!
> /usr/lib/libc.so.4: WARNING!  encrypt(3) not present in the system!
> /usr/lib/libc.so.4: warning: tmpnam() possibly used unsafely; consider using mkstemp()
> /usr/lib/libc.so.4: warning: this program uses f_prealloc(), which is stupid.
> /usr/lib/libc.so.4: WARNING!  des_cipher(3) not present in the system!
> /usr/lib/libc.so.4: warning: tempnam() possibly used unsafely; consider using mkstemp()
> creating testgthread
> ----------------------------------------------------------------------
> 
> 
>>  $.02,
>>  /Mikko
>>
> 
> any ideas?  i know the warnings are generated from libc (just grep
> around /usr/src/lib/libc).  i can't find anything that references
> those symbols.  also, i must not be understanding -pthread, because i
> thought it _replaced_ libc with libc_r.
> 
> david
> 
> p.s.: again, please remember to reply to me in addition to the lists.
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 
> 

jim
-- 
ET has one helluva sense of humor!
He's always anal-probing right-wing schizos!


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B858F0B.5050300>