6.2 buildworld fails with NO_SHARED
Bill Vermillion
bv at wjv.com
Sat Jan 27 23:54:34 UTC 2007
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 <bsd.prog.mk>
> --
> Dan Nelson
> dnelson at 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
More information about the freebsd-stable
mailing list