From owner-freebsd-questions Fri May 22 19:31:24 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA15992 for freebsd-questions-outgoing; Fri, 22 May 1998 19:31:24 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from freebie.lemis.com (freebie.lemis.com [139.130.136.133]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA15982 for ; Fri, 22 May 1998 19:31:16 -0700 (PDT) (envelope-from grog@lemis.com) Received: (from grog@localhost) by freebie.lemis.com (8.8.8/8.8.7) id MAA00302; Sat, 23 May 1998 12:00:58 +0930 (CST) (envelope-from grog) Message-ID: <19980523120058.K339@freebie.lemis.com> Date: Sat, 23 May 1998 12:00:58 +0930 From: Greg Lehey To: Mark Ovens , questions@FreeBSD.ORG Subject: Re: gcc linker problems References: <35656F1C.C4A9A6BE@uk.radan.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <35656F1C.C4A9A6BE@uk.radan.com>; from Mark Ovens on Fri, May 22, 1998 at 01:27:08PM +0100 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 22 May 1998 at 13:27:08 +0100, Mark Ovens wrote: > Hi, > I'm having a few problems (static) linking some programs with gcc. The > program comes from a Sun4.x and I've got everything to compile OK but > get errors when linking. The compiling/linking is run from scripts which > produce the following: > > cc file1.o file2.o -lrad > > The errors (100's of them!) are of the form: > > file1.o: undefined symbol '_sys_get_status' referenced in text segment > > In all cases the symbols are defined in librad.a (confirmed with nm) and > are declared extern in the source (in the header files). I don't have a librad.a, so I can't compare. Are you sure the symbols are really of the correct type? They should look something like: 000001a4 T _sys_get_status Beware in particular of this: 000001a4 t _sys_get_status This is a private symbol, and the linker won't find it. The other possibility is that you have a number of files which match -lrad, and you're getting the wrong one. Without options, I believe it'll look for a librad.so. first. Try -Bstatic to force a static executable if your librad.so* doesn't contain the symbols you need. > I guess this is just a case of the options to cc being different for gcc > than for the Sun (Sparcworks C compiler v3.0.1), which was all I had to > modify to compile the source, but I can't work out what needs changing > for the linker. > > I'm not looking for a definitive to solution to this specific case just > some pointers (no pun intended) to the correct options to use (I would > have to trawl through the scripts to work out exactly what options are > currently being used). The options look right to me. I'd guess that your problem is elsewhere. Greg -- See complete headers for address and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message