Building base system with CFLAGS=-static

Erik Trulsson ertr1013 at student.uu.se
Thu Nov 25 04:29:55 PST 2004


On Thu, Nov 25, 2004 at 01:19:44PM +0100, Erik Norgaard wrote:
> Hi,
> 
> I am trying to build the base system statically linked to create an 
> installation root file system.
> 
> I have tried "make CFLAGS=-static buildworld", which fails. Building 
> each program separately, in most cases it works with "make 
> CFLAGS=-static" but some like systinstall, sh, csh and init fails.
> 
> What is the suggested method to create a static built base system?
> Alternatively, how do I trace which libraries are used/needed?

make NOSHARED=yes buildworld

should work fine for building a statically linked system.

(If you are using 4-stable you will probably have to apply the
following patch to make the world build correctly using NOSHARED=yes,
at least if you use NOPAM=yes.  No idea how it works if you compile
with PAM support which is the default.)

Index: usr.bin/fetch/Makefile
===================================================================
RCS file: /ncvs/src/usr.bin/fetch/Makefile,v
retrieving revision 1.3.6.4
diff -u -r1.3.6.4 Makefile
--- usr.bin/fetch/Makefile	9 Jan 2003 11:54:58 -0000	1.3.6.4
+++ usr.bin/fetch/Makefile	20 Nov 2003 16:59:18 -0000
@@ -6,8 +6,8 @@
 DPADD=		${LIBFETCH}
 LDADD=		-lfetch
 .if !defined(NOCRYPT) && !defined(NOSECURE) && !defined(NO_OPENSSL)
-DPADD+=		${LIBCRYPTO} ${LIBSSL}
-LDADD+=		-lcrypto -lssl
+DPADD+=		${LIBSSL} ${LIBCRYPTO}
+LDADD+=		-lssl -lcrypto
 .endif
 
 .include <bsd.prog.mk>
Index: usr.sbin/rpc.statd/file.c
===================================================================
RCS file: /ncvs/src/usr.sbin/rpc.statd/file.c,v
retrieving revision 1.3
diff -u -r1.3 file.c
--- usr.sbin/rpc.statd/file.c	13 Oct 1997 11:13:18 -0000	1.3
+++ usr.sbin/rpc.statd/file.c	20 Nov 2003 18:53:24 -0000
@@ -207,28 +207,6 @@
   }
 }
 
-/* xdr_stat_chge ----------------------------------------------------------- */
-/*
-   Purpose:	XDR-encode structure of type stat_chge
-   Returns:	TRUE if successful
-   Notes:	This function is missing from librpcsvc, because the
-		sm_inter.x distributed by Sun omits the SM_NOTIFY
-		procedure used between co-operating statd's
-*/
-
-bool_t xdr_stat_chge(XDR *xdrs, stat_chge *objp)
-{
-  if (!xdr_string(xdrs, &objp->mon_name, SM_MAXSTRLEN))
-  {
-    return (FALSE);
-  }
-  if (!xdr_int(xdrs, &objp->state))
-  {
-    return (FALSE);
-  }
-  return (TRUE);
-}
-
 
 /* notify_one_host --------------------------------------------------------- */
 /*




-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list