In the last episode (Jan 26), Bill Vermillion said:
> I had wanted to build static binaries in /bin and /sbin - so
> I set NO_SHARED.  The man pages says "... this can be bad. If set
> every utility that uses bsd.prog.mk will be linked statically."
> 
> Here is the tail end of the output of make buildworld as I mailed
> it to me from the machine I was bringing up as we start to replace
> all the 4.11 servers.
> 
> > ===> usr.sbin/gstat (all)
> > cc -O2 -fno-strict-aliasing -pipe  -Wsystem-headers -Werror -Wall 
> > -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes 
> > -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual 
> > -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -c 
> > /usr/src/usr.sbin/gstat/gstat.c
> > cc -O2 -fno-strict-aliasing -pipe  -Wsystem-headers -Werror -Wall 
> > -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes 
> > -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual 
> > -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter  -static 
> > -o gstat gstat.o -lgeom -ldevstat -lbsdxml -lcurses -ledit
> > /usr/obj/usr/src/tmp/usr/lib/libgeom.a(geom_xml2tree.o)(.text+0x1c): In 
> > function `StartElement':
> > : undefined reference to `sbuf_new'
> > /usr/obj/usr/src/tmp/usr/lib/libdevstat.a(devstat.o)(.text+0x1538): In 
> > function `readkmem':
> > : undefined reference to `kvm_read'
> > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x3938): In 
> > function `term_deletechars':
> > : undefined reference to `tgoto'

Looks like there are some missing/misordered library dependencies. 
Moving -lcurses after -ledit, and adding -lkvm and -lsbuf fixes it.

The main thing you lose by statically linking is dlopen(), so nsswitch
and pam modules from ports won't work.  Modules built into libc.a or
libpam.a (NIS and pam_unix for example) will work.  Also, if you're on
-current you can tell cached to do NSS lookups on behalf of static
binaries.

Index: Makefile
===================================================================
RCS file: /home/ncvs/src/usr.sbin/gstat/Makefile,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 Makefile
--- Makefile    10 Jun 2006 15:40:10 -0000      1.6.2.1
+++ Makefile    26 Jan 2007 17:00:38 -0000
@@ -3,7 +3,7 @@
 PROG=  gstat
 MAN=   gstat.8
 WARNS?=        5
-DPADD= ${LIBGEOM} ${LIBDEVSTAT} ${LIBBSDXML} ${LIBCURSES} ${LIBEDIT}
-LDADD= -lgeom -ldevstat -lbsdxml -lcurses -ledit
+DPADD= ${LIBGEOM} ${LIBDEVSTAT} ${LIBBSDXML} ${LIBEDIT} ${LIBCURSES}
+LDADD= -lgeom -ldevstat -lbsdxml -ledit -lcurses -lkvm -lsbuf
 
 .include <bsd.prog.mk>


-- 
        Dan Nelson
        [EMAIL PROTECTED]
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to