Subject: Re: static linking
To: David Brownlee <abs@anim.dreamworks.com>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: netbsd-help
Date: 08/04/1999 11:17:29
David Brownlee wrote:
> 
> 	That _should_ work - are all of the libraries against which you
> 	are linking available in static form?
> 
> 	What does a 'cc -v -static ...' give?
> 
> 
> On Tue, 3 Aug 1999, Patrick Welche wrote:
> 
> > This is on release NetBSD-1.4/i386. I thought all I needed was
> > 
> > 	LDSTATIC=-static
> > 
> > in the Makefile, but
> > 
> > % make
> > cc  -static -o admin.cgi admin.o dbase.o monad.o user.o keyvalue.o www.o mail.o policy.o -lstdc++ -L/usr/local/pgsql/lib -lpq++ -lpq
> > ld: No reference to __DYNAMIC
> > collect2: ld returned 1 exit status
> > *** Error code 1
> > 
> > Stop.

henry% ls /usr/local/pgsql/lib/lib*.a
/usr/local/pgsql/lib/libecpg.a          /usr/local/pgsql/lib/libpq.a
/usr/local/pgsql/lib/libpq++.a
henry% ls /usr/lib/lib{c,stdc++}.a
/usr/lib/libc.a           /usr/lib/libstdc++.a
henry% cc -v -static -o admin.cgi admin.o dbase.o monad.o user.o keyvalue.o www.o mail.o policy.o -lstdc++ -L/usr/local/pgsql/lib -lpq++ -lpq
Using builtin specs.
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
 /usr/libexec/collect2 -e start -dc -dp -Bstatic -o admin.cgi /usr/lib/scrt0.o -L/usr/local/pgsql/lib -L/usr/libexec admin.o dbase.o monad.o user.o keyvalue.o www.o mail.o policy.o -lstdc++ -lpq++ -lpq -lgcc -lc -lgcc
ld: No reference to __DYNAMIC
collect2: ld returned 1 exit status

I don't understand the error message.. The .o files are compiled from .cc
files if this makes a difference.

Cheers,

Patrick