From owner-freebsd-stable@FreeBSD.ORG Sat Jan 27 23:54:34 2007 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E38A616A401 for ; Sat, 27 Jan 2007 23:54:33 +0000 (UTC) (envelope-from bv@bilver.wjv.com) Received: from wjv.com (fl-65-40-24-38.sta.embarqhsd.net [65.40.24.38]) by mx1.freebsd.org (Postfix) with ESMTP id 8C0D113C4A8 for ; Sat, 27 Jan 2007 23:54:33 +0000 (UTC) (envelope-from bv@bilver.wjv.com) Received: from bilver.wjv.com (localhost.wjv.com [127.0.0.1]) by wjv.com (8.13.8/8.13.1) with ESMTP id l0RNsEYZ050554; Sat, 27 Jan 2007 18:54:14 -0500 (EST) (envelope-from bv@bilver.wjv.com) Received: (from bv@localhost) by bilver.wjv.com (8.13.8/8.13.1/Submit) id l0RNs8uv050553; Sat, 27 Jan 2007 18:54:08 -0500 (EST) (envelope-from bv) Date: Sat, 27 Jan 2007 18:54:08 -0500 From: Bill Vermillion To: Dan Nelson Message-ID: <20070127235408.GA50433@wjv.com> References: <20070126161022.GB29530@wjv.com> <20070126171552.GA24490@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070126171552.GA24490@dan.emsphone.com> User-Agent: Mutt/1.4.2.2i Organization: W.J.Vermillion / Orlando - Winter Park ReplyTo: bv@wjv.com X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.1.7 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on bilver.wjv.com Cc: freebsd-stable@freebsd.org Subject: Re: 6.2 buildworld fails with NO_SHARED X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bv@wjv.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jan 2007 23:54:34 -0000 Even though on Fri, Jan 26, 2007 at 11:15 Dan Nelson realized that everything he says should be taken 'cum grano salis', he unhesitatingly continued with this missive: Took me awhile to get some time to try this again - wjv > 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 > -- > Dan Nelson > dnelson@allantgroup.com That fixed the errors as above. However now I get errors further down. But first - should this not be fixed in the Makefile. make.conf(5) says in part using the NO_SHARED ".. can be bad. ..." I would think the above info about breaking the ports of nsswitch and the PAM modules wouldn't work might be listed as >some< of the possibilities instead of 'can be bad'. The other respondant to this post mentioned that the statically built pieces of /bin and /sbin are in rescue. I see those are all in one large file that is linked to all the possible names. No real problem there, but that brings up another question. If - as documented in make.conf(5) - I put use the variable NO_DYNAMIC_ROOT it says "set this is you do not want to link /bin and /sbin dynamically". Would that be the way to build statics in /bin and /sbin instead of NO_SHARED. And now onto the current thing I see. I removed all of /usr/obj/src to be sure I started clean. I had the variable NO_SHARED in /etc/make.conf. The compile passed the place where it failed before as your fix to the make file seem to cure that. Now this is what I see when NO_SHARED is used. This is just the tail end of the nohup output. ------------- cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/info/../lib -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 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat=2 -Wno-format-extra-args -Werror -static -o pkg_info main.o perform.o show.o /usr/obj/usr/src/usr.sbin/pkg_install/info/../lib/libinstall.a -lfetch -lmd -lssl -lcrypto gzip -cn /usr/src/usr.sbin/pkg_install/info/pkg_info.1 > pkg_info.1.gz ===> usr.sbin/pkg_install/sign (all) cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/main.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/check.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/common.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/gzip.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/pgp_check.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/pgp_sign.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/sha1.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/sign.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/stand.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -c /usr/src/usr.sbin/pkg_install/sign/x509.c cc -O2 -fno-strict-aliasing -pipe -I/usr/src/usr.sbin/pkg_install/sign/../lib -static -o pkg_sign main.o check.o common.o gzip.o pgp_check.o pgp_sign.o sha1.o sign.o stand.o x509.o /usr/obj/usr/src/usr.sbin/pkg_install/sign/../lib/libinstall.a -lmd -lcrypto /usr/obj/usr/src/tmp/usr/lib/libc.a(err.o)(.text+0x33c): In function `warnx': : multiple definition of `warnx' stand.o(.text+0xb0): first defined here /usr/obj/usr/src/tmp/usr/bin/ld: Warning: size of symbol `warnx' changed from 81 in stand.o to 20 in /usr/obj/usr/src/tmp/usr/lib/libc.a(err.o) *** Error code 1 Stop in /usr/src/usr.sbin/pkg_install/sign. *** Error code 1 Stop in /usr/src/usr.sbin/pkg_install. *** Error code 1 Stop in /usr/src/usr.sbin. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. *** Error code 1 Stop in /usr/src. 3189.30 real 2863.34 user 288.46 sys ------------- Bill -- Bill Vermillion - bv @ wjv . com