Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 1998 12:00:58 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Mark Ovens <marko@uk.radan.com>, questions@FreeBSD.ORG
Subject:   Re: gcc linker problems
Message-ID:  <19980523120058.K339@freebie.lemis.com>
In-Reply-To: <35656F1C.C4A9A6BE@uk.radan.com>; from Mark Ovens on Fri, May 22, 1998 at 01:27:08PM %2B0100
References:  <35656F1C.C4A9A6BE@uk.radan.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <options> 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.<mumble> 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



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