From owner-freebsd-hackers Thu Aug 23 14:12:18 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from amant.pdl.cs.cmu.edu (AMANT.PDL.CS.CMU.EDU [128.2.189.84]) by hub.freebsd.org (Postfix) with ESMTP id 9262437B40F; Thu, 23 Aug 2001 14:12:02 -0700 (PDT) (envelope-from dpetrou@amant.pdl.cs.cmu.edu) Received: (from dpetrou@localhost) by amant.pdl.cs.cmu.edu (8.11.1/8.11.1) id f7NLBv394063; Thu, 23 Aug 2001 17:11:57 -0400 (EDT) (envelope-from dpetrou) Date: Thu, 23 Aug 2001 17:11:57 -0400 From: David Petrou To: Mikko Tyolajarvi Cc: freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: wacky warnings linking multithreaded code Message-ID: <20010823171156.G24447@amant.pdl.cs.cmu.edu> Reply-To: dpetrou@cs.cmu.edu References: <20010823150044.E24447@amant.pdl.cs.cmu.edu> <200108232105.f7NL50119378@mikko.dynas.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200108232105.f7NL50119378@mikko.dynas.se>; from mikko@dynas.se on Thu, Aug 23, 2001 at 11:05:00PM +0200 X-Hit-Pick: Beatles / Beatles For Sale Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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