From owner-freebsd-questions@FreeBSD.ORG Sun Mar 6 21:55:04 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E38616A4CE for ; Sun, 6 Mar 2005 21:55:04 +0000 (GMT) Received: from yearning.mcc.ac.uk (yearning.mcc.ac.uk [130.88.203.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAF4643D39 for ; Sun, 6 Mar 2005 21:55:03 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97]) by yearning.mcc.ac.uk with esmtp (Exim 4.43 (FreeBSD)) id 1D83iI-000K1L-VU; Sun, 06 Mar 2005 21:55:03 +0000 Received: from dogma.freebsd-uk.eu.org (localhost [127.0.0.1]) j26Lt1e9005708; Sun, 6 Mar 2005 21:55:02 GMT (envelope-from jcm@dogma.freebsd-uk.eu.org) Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.13.1/8.12.6/Submit) id j26Lt14C005707; Sun, 6 Mar 2005 21:55:01 GMT Date: Sun, 6 Mar 2005 21:55:00 +0000 From: Jonathon McKitrick To: Giorgos Keramidas Message-ID: <20050306215500.GA5571@dogma.freebsd-uk.eu.org> References: <20050305183226.GA47472@dogma.freebsd-uk.eu.org> <20050306011827.GE2272@dan.emsphone.com> <20050306213249.GA4624@dogma.freebsd-uk.eu.org> <20050306213955.GA11496@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050306213955.GA11496@gothmog.gr> User-Agent: Mutt/1.4i cc: Dan Nelson cc: freebsd-questions@freebsd.org Subject: Re: Which lib for pthreads? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2005 21:55:04 -0000 On Sun, Mar 06, 2005 at 11:39:55PM +0200, Giorgos Keramidas wrote: : On 2005-03-06 21:32, Jonathon McKitrick wrote: : >On Sat, Mar 05, 2005 at 07:18:31PM -0600, Dan Nelson wrote: : >:In the last episode (Mar 05), Jonathon McKitrick said: : >:> Linux lets me use -pthread, but under BSD I get 'undefined symbol : >:> "pthread_mutex_lock."' : >:> : >:> What's the correct linker syntax for pthreads? : >: : >: That would be it. It should work on 4.* and 5.*. : > : > I found -lc_r does the trick. Not what I was expecting. : : -lpthread should work too. Hmmmm... jcm@worker:...cvs/tcontainer/libplugina> make install cc -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c plugina.c c++ -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c wrapper.cpp c++ -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c myclass.cpp cc -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c threads.c cc -O -pipe -Wall -g -I.. -I../include -shared -fPIC -lpthread -lstdc++ -g -Wl,-soname,libplugina.so.0 -o libplugina.so.0.0 plugina.o wrapper.o myclass.o threads.o /usr/libexec/elf/ld: cannot find -lpthread *** Error code 1 Stop in /usr/home/jcm/cvs/tcontainer/libplugina. jcm@worker:...cvs/tcontainer/libplugina> What about -pthread? jcm@worker:...cvs/tcontainer/libplugina> make install cc -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c plugina.c c++ -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c wrapper.cpp c++ -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c myclass.cpp cc -O -pipe -Wall -g -I.. -I../include -shared -fPIC -c threads.c cc -O -pipe -Wall -g -I.. -I../include -shared -fPIC -pthread -lstdc++ -g -Wl,-soname,libplugina.so.0 -o libplugina.so.0.0 plugina.o wrapper.o myclass.o threads.o ---> Installing libplugina.so to /home/jcm/lib install -m 644 libplugina.so.0.0 /home/jcm/lib ln -sf libplugina.so.0.0 /home/jcm/lib/libplugina.so.0 ln -sf libplugina.so.0 /home/jcm/lib/libplugina.so jcm@worker:...cvs/tcontainer/libplugina> app /usr/libexec/ld-elf.so.1: /home/jcm/lib/libplugina.so: Undefined symbol "pthread_create" jcm@worker:...cvs/tcontainer/libplugina> Jonathon McKitrick -- My other computer is your Windows box.