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." I have problems in the past - on other platforms - where having statically linked tools in /bin saved the day. [Fixing things that some other SA's had no clue about as to what they were doing]. There really is nothing to indicated what 'bad' may be - other than statically linking these. I took the NO_SHARED out and the buildworld went just fine. Is this a bug? I would think if the variable is set and useable things should work. 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. The verison is 6.2-STABLE with the tag in the cvsup set as RELENG_6_2. So this is exact with the release on Jan 19. Do I need to send this to anyone to look at. Any hints? Or should I just 'fugidaboudid' Bill ----- Forwarded message from Charlie Root <root@build2.wanlogistics.net> -----> From: Charlie Root <root@build2.wanlogistics.net> > To: bv@wjv.com > Date: Fri, 26 Jan 2007 10:52:42 -0500 > Subject: errors on buldworkd with NO_SHARED > X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on bilver.wjv.com > X-Spam-Level: > X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 > autolearn=ham version=3.1.7 > > 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 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -static -o getfmac getfmac.o > gzip -cn /usr/src/usr.sbin/getfmac/getfmac.8 > getfmac.8.gz > ===> usr.sbin/getpmac (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 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -c /usr/src/usr.sbin/getpmac/getpmac.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 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -static -o getpmac getpmac.o > gzip -cn /usr/src/usr.sbin/getpmac/getpmac.8 > getpmac.8.gz > ===> 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/libgeom.a(geom_xml2tree.o)(.text+0x42e): In function `EndElement': > : undefined reference to `sbuf_finish' > /usr/obj/usr/src/tmp/usr/lib/libgeom.a(geom_xml2tree.o)(.text+0x43b): In function `EndElement': > : undefined reference to `sbuf_data' > /usr/obj/usr/src/tmp/usr/lib/libgeom.a(geom_xml2tree.o)(.text+0x453): In function `EndElement': > : undefined reference to `sbuf_delete' > /usr/obj/usr/src/tmp/usr/lib/libgeom.a(geom_xml2tree.o)(.text+0x808): In function `CharData': > : undefined reference to `sbuf_bcat' > /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/libdevstat.a(devstat.o)(.text+0x1550): In function `readkmem': > : undefined reference to `kvm_geterr' > /usr/obj/usr/src/tmp/usr/lib/libdevstat.a(devstat.o)(.text+0x1591): In function `readkmem_nl': > : undefined reference to `kvm_nlist' > /usr/obj/usr/src/tmp/usr/lib/libdevstat.a(devstat.o)(.text+0x15b8): In function `readkmem_nl': > : undefined reference to `kvm_geterr' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x3938): In function `term_deletechars': > : undefined reference to `tgoto' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x3c56): In function `term_echotc': > : undefined reference to `tgetstr' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x3dbc): In function `term_echotc': > : undefined reference to `tgoto' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4bd9): In function `term_set': > : undefined reference to `tgetent' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4bf7): In function `term_set': > : undefined reference to `tgetflag' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c0e): In function `term_set': > : undefined reference to `tgetflag' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c20): In function `term_set': > : undefined reference to `tgetflag' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c32): In function `term_set': > : undefined reference to `tgetflag' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c44): In function `term_set': > : undefined reference to `tgetflag' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c56): more undefined references to `tgetflag' follow > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c68): In function `term_set': > : undefined reference to `tgetnum' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4c7a): In function `term_set': > : undefined reference to `tgetnum' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x4cb6): In function `term_set': > : undefined reference to `tgetstr' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x509f): In function `term_move_to_char': > : undefined reference to `tgoto' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x5258): In function `term_move_to_line': > : undefined reference to `tgoto' > /usr/obj/usr/src/tmp/usr/lib/libedit.a(editline.o)(.text+0x5381): In function `term_insertwrite': > : undefined reference to `tgoto' > *** Error code 1 > > Stop in /usr/src/usr.sbin/gstat. > *** 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.----- End forwarded message ----- -- Bill Vermillion - bv @ wjv . com
On 1/26/07, Bill Vermillion <bv@wjv.com> wrote:> 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." > > I have problems in the past - on other platforms - where having > statically linked tools in /bin saved the day. [Fixing things that > some other SA's had no clue about as to what they were doing]. >Since FreeBSD went to dynamically linked binaries, there is the /rescue directory which contains static binaries of the programs you would need to recover from a failure.> There really is nothing to indicated what 'bad' may be - other than > statically linking these. > > I took the NO_SHARED out and the buildworld went just fine. > > Is this a bug? I would think if the variable is set and useable > things should work. >Seems to be a bug, as their appears to be missing libraries in the NO_SHARED case.> 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. > > The verison is 6.2-STABLE with the tag in the cvsup set > as RELENG_6_2. So this is exact with the release on Jan 19. > > Do I need to send this to anyone to look at. Any hints? Or should > I just 'fugidaboudid' >> > 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 -leditsbuf(9) - sbuf_new, sbuf_clear, sbuf_setpos, sbuf_bcat, sbuf_bcopyin, sbuf_bcpy, sbuf_cat, sbuf_copyin, sbuf_cpy, sbuf_printf, sbuf_vprintf, sbuf_putc, sbuf_trim, sbuf_overflowed, sbuf_finish, sbuf_data, sbuf_len, sbuf_delete - safe string formatting> > : undefined reference to `sbuf_new' > > : undefined reference to `sbuf_finish' > > : undefined reference to `sbuf_data' > > : undefined reference to `sbuf_delete' > > : undefined reference to `sbuf_bcat'Not sure which library has the above function in them. The following functions seem to be defined in libkvm.> > : undefined reference to `kvm_read' > > : undefined reference to `kvm_geterr' > > : undefined reference to `kvm_nlist' > > : undefined reference to `kvm_geterr'curs_termcap (3X) - tgetent, tgetflag, tgetnum, tgetstr, tgoto, tputs - direct curses interface to the terminfo capability database> > : undefined reference to `tgoto' > > : undefined reference to `tgetstr' > > : undefined reference to `tgetent' > > : undefined reference to `tgetflag' > > : undefined reference to `tgetnum'These seem to come from curses, but are not in your libcurses library. Is there another library these functions come from? Scot -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.
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 dnelson@allantgroup.com
On Fri, Jan 26, 2007 at 11:10:22AM -0500, Bill Vermillion wrote:> 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."Have you tried NO_DYNAMICROOT? It's documented in make.conf(5) Eugene Grosbein