From owner-freebsd-hackers  Thu Feb 14 13:53:13 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from mail.pcnet.com (pcnet1.pcnet.com [204.213.232.3])
	by hub.freebsd.org (Postfix) with ESMTP id 92F5737B41A
	for <freebsd-hackers@FreeBSD.ORG>; Thu, 14 Feb 2002 13:53:08 -0800 (PST)
Received: from localhost (eischen@localhost)
	by mail.pcnet.com (8.12.1/8.12.1) with ESMTP id g1ELr7CN023802;
	Thu, 14 Feb 2002 16:53:07 -0500 (EST)
Date: Thu, 14 Feb 2002 16:53:07 -0500 (EST)
From: Daniel Eischen <eischen@pcnet1.pcnet.com>
To: Hiten Pandya <hiten@uk.FreeBSD.org>
Cc: freebsd-hackers@FreeBSD.ORG
Subject: Re: weird pthread related errors
In-Reply-To: <20020214214240.A7121@hpdi.ath.cx>
Message-ID: <Pine.GSO.4.10.10202141650090.23286-100000@pcnet1.pcnet.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-hackers.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-hackers>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-hackers>
X-Loop: FreeBSD.ORG

On Thu, 14 Feb 2002, Hiten Pandya wrote:
> Howdy!,
> 
> I am having some very weird problems with the pthread.h
> library.  The following statement is in the source-file:
> 
>      #include <pthread.h>
> 
> But, the compiler fails with the following error messages.

The error you attach below is not really a compiler error; it
is a link error.

> All the other typedefs, structs are recognised except:
> 
>   - pthread_create();
>   - pthread_exit();
> 
> It would be very appreciated if someone can help me solve
> this dillema.  I have tried to look _just_ about everywhere,
> including the headers, but cannot find a clue why it is
> failing.
> 
> If needed, I can also file an official PR regarding this
> problem, but I have posted to the list, as I assumed someone
> might have solved this dillema before. ;)
> 
> The following is the error output:
> 
> gcc  -g -O2   -o fsck.jfs  fsckbmap.o fsckconn.o  fsckdire.o fsckdtre.o fsckea.o  fsckimap.o fsckino.o fsckmeta.o  fsckmsgs.o fsckpfs.o fsckwsp.o  fsckxtre.o xchkdsk.o fsckruns.o ../libfs/libfs.a 
> fsckruns.o: In function `fsck_hbeat':
> /c0/cvs/j4b/jfsutils/fsck/fsckruns.c:156: undefined reference to `pthread_exit'
> fsckruns.o: In function `fsck_hbeat_start':
> /c0/cvs/j4b/jfsutils/fsck/fsckruns.c:180: undefined reference to `pthread_create'

If you want to use the threads library, you have to tell the
linker (-lc_r in -current, -pthread in -stable).

-- 
Dan Eischen


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