UPDATING revision 1.21
11.21Sjmc$NetBSD: UPDATING,v 1.21 2001/03/06 19:00:59 jmc Exp $
21.1Sabs
31.1SabsThis file is intended to be a brief introduction to the build
41.1Sabsprocess and a reference on what to do if something doesn't work.
51.1Sabs
61.1SabsFor a more detailed description see Makefile.
71.1Sabs
81.1SabsRecent changes:
91.1Sabs^^^^^^^^^^^^^^^
101.21Sjmc
111.21Sjmc20010226:
121.21Sjmc
131.21Sjmc	Added named group to /etc/group. Need to hand add this in or builds
141.21Sjmc	will break as mtree aborts early.
151.21Sjmc
161.21Sjmc	To work around add by hand:
171.21Sjmc
181.21Sjmc	named:*:14:
191.21Sjmc
201.21Sjmc	to /etc/group before make build.
211.18Sjmc
221.18Sjmc20010219:
231.18Sjmc	get/setprogname() added. Any hostprog's that may use this will need
241.20Sjmc        to be bootstrapped manually until the host system is current.
251.18Sjmc
261.18Sjmc        Known problems: sys/arch/macppc/stand/fixcoff
271.19Scgd			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
281.19Scgd			  CFLAGS and rebuilding should work)
291.20Sjmc			usr.sbin/mdsetimage - Build a static copy if
301.20Sjmc  		          building a snapshot before fully bootstrapped.
311.15Schristos
321.15Schristos20010204:
331.15Schristos	prepare the code to compile with stricter gcc flags. in
341.15Schristos	particular start eliminating redundant declarations. Yacc
351.15Schristos	needs to be installed before make build.
361.10Schristos
371.10Schristos20010114:
381.10Schristos	introduce .if commands(target) in make(1). You need to
391.10Schristos	bring everything up-to-date first, then without installing
401.10Schristos	anything make and install in /usr/bin/make, then proceed
411.10Schristos	with make build.
421.9Ssommerfe
431.9Ssommerfe20010101:
441.9Ssommerfe	bsd.subdir.mk committed 20001230 had a bug which caused
451.9Ssommerfe	afterinstall targets to run too soon; update again.
461.8Ssommerfe
471.8Ssommerfe20001230:
481.8Ssommerfe	New share/mk files needed to support .WAIT in SUBDIR variables.
491.8Ssommerfe	If you get make errors, 
501.8Ssommerfe		(cd share/mk; make install)
511.8Ssommerfe	Also, PRINTOBJDIR has changed and is now used more heavily.
521.6Sad
531.6Sad20001019:
541.7Sad	The `ca' device driver has been replaced by `ld'; although the
551.6Sad	major and minor numbers haven't changed, you should update your /dev
561.6Sad	directory.
571.1Sabs
581.4Sitojun20000929:
591.4Sitojun	The following make directives are obsoleted.
601.4Sitojun	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
611.4Sitojun	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
621.16Swiz	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
631.4Sitojun	additional library libcrypto_{idea,rc5}.
641.4Sitojun
651.1Sabs20000623:
661.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
671.1Sabs	'cd share/mk ; make install' needed before make build.
681.1Sabs
691.1Sabs
701.1SabsHints for a more successful build:
711.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
721.2Smrg    Build a new kernel first:
731.2Smrg	This makes sure that any new system calls or features
741.2Smrg	   expected by the new userland will be present.  This
751.2Smrg	   helps to avoid critical errors when upgrading.
761.1Sabs    Use object directories:
771.1Sabs	This helps to keep stale object
781.1Sabs	   files from polluting the build if a Makefile "forgets"
791.1Sabs	   about one.  It also makes it easier to clean up after
801.1Sabs	   a build.  It's also necessary if you want to use the
811.1Sabs	   same source tree for multiple machines.
821.1Sabs	   To use object directories:
831.1Sabs	    a) cd /usr/src ; make cleandir
841.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
851.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
861.1Sabs	    d) cd /usr/src ; make build
871.2Smrg	   Note that running "make obj" in a directory will create
881.2Smrg	   in obj.$MACHINE directory.
891.1Sabs    Build to a DESTDIR:
901.1Sabs	This helps to keep old
911.1Sabs	   installed files (especially libraries) from interfering
921.1Sabs	   with the new build.
931.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
941.2Smrg	   variable before running make build.  It should be set to
951.2Smrg	   the pathname of an initially empty directory.
961.1Sabs	   Problems: you might need to update critical utilities
971.1Sabs		without using DESTDIR since nothing is executed
981.1Sabs		from what is installed in DESTDIR.
991.1Sabs		(See critical utils, below)
1001.1Sabs    Build often:
1011.1Sabs	This keeps critical utilities current enough to not choke
1021.1Sabs	on any other part of the source tree that depends on up to
1031.1Sabs	date functionality.
1041.1Sabs 
1051.1SabsWhat to do if things don't work:
1061.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1071.1SabsWhen things don't work there is usually a few things that commonly
1081.1Sabsshould be done.
1091.1Sabs    1)	make includes
1101.1Sabs	This should be done automatically by make build.
1111.1Sabs    2)  cd share/mk && make install
1121.1Sabs	Again, automatically done by make build.
1131.1Sabs
1141.1SabsFailsafe rebuild of a small part of the tree:
1151.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1161.1SabsTo make sure you rebuild something correctly you want to do
1171.1Sabssomething like the following:
1181.1Sabs    1)  Make sure the includes and .mk files are up to date.
1191.1Sabs    2)  Make sure any program used to build the particular
1201.1Sabs	utility is up to date.  (yacc, lex, etc...)
1211.1Sabs    3)  cd ...path/to/util...
1221.1Sabs	make cleandir
1231.1Sabs	rm ...all obj directories...
1241.1Sabs	make cleandir			# yes, again
1251.1Sabs	make obj
1261.1Sabs	make depend && make
1271.1Sabs
1281.1SabsFailsafe rebuild of the entire tree:
1291.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1301.1SabsIf you really want to make sure the source tree is clean and
1311.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
1321.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
1331.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
1341.1Sabs
1351.1Sabs---cut here---
1361.1Sabs#!/bin/sh
1371.1Sabs. /etc/mk.conf
1381.1Sabs
1391.1Sabsif [ -z $BSDSRCDIR ] ; then
1401.1Sabs    BSDSRCDIR=/usr/src
1411.1Sabsfi
1421.1Sabsif [ \! -d $BSDSRCDIR ] ; then
1431.1Sabs    echo Unable to find sources
1441.1Sabs    exit 1
1451.1Sabsfi
1461.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
1471.1Sabs
1481.1Sabsif [ -z $BSDOBJDIR ] ; then
1491.1Sabs    BSDOBJDIR=/usr/obj
1501.1Sabsfi
1511.1Sabsif [ -d $BSDOBJDIR ] ; then
1521.1Sabs    rm -rf $BSDOBJDIR
1531.1Sabsfi
1541.1Sabs
1551.1Sabscd $BSDSRCDIR && make cleandir
1561.1Sabs
1571.1Sabs---cut here---
1581.1Sabs
1591.1SabsCritical utilities:
1601.1Sabs^^^^^^^^^^^^^^^^^^^
1611.1Sabs	gnu/usr.bin/egcs
1621.3Sitojun	usr.bin/compile_et
1631.1Sabs	usr.bin/make
1641.1Sabs	usr.bin/yacc
1651.1Sabs	usr.bin/lex
1661.11Slukem	usr.bin/xlint
1671.2Smrg	usr.sbin/config
1681.1Sabs
1691.1SabsOther problems and possibly solutions:
1701.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1711.1SabsSymptom:Unreasonable compiler errors.
1721.1SabsFix:	Rebuild gnu/usr.bin/egcs
1731.1Sabs
1741.1SabsSymptom:Complaints involving a Makefile.
1751.17SerhFix:	Rebuild usr.bin/make:
1761.17Serh	cd usr.bin/make && make && make install
1771.17Serh        Or, a failsafe method if that doesn't work:
1781.17Serh	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
1791.17Serh
1801.1SabsFix:	Make sure .mk files are up to date.
1811.1Sabs	cd share/mk && make install
1821.2Smrg
1831.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
1841.2SmrgFix:	Rebuild usr.sbin/config
1851.1Sabs
1861.1SabsSymptom:
1871.1SabsFix:	Rebuild usr.bin/yacc
1881.1Sabs
1891.1SabsSymptom:
1901.1SabsFix:	Rebuild usr.bin/lex
1911.1Sabs
1921.1SabsSymptom:
1931.1SabsFix:	rm /usr/lib/libbfd.a
1941.4Sitojun
1951.4SitojunSymptom:Obsolete intermediate files are used during compilation
1961.4SitojunFix:	Try the following sequence of commands in the directory in question.
1971.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
1981.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
1991.4Sitojun	may remain.  The command tries to clean everything up)
2001.5Swiz
2011.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
2021.5SwizFix:	Rebuild and install usr.bin/menuc
2031.12Sitojun
2041.12SitojunSymptom:mklocale not found during build in share/locale/ctype
2051.12SitojunFix:	Build and install usr.bin/mklocale
2061.13Sdogcow
2071.13SdogcowSymptom:undefined reference to `__assert13'
2081.13SdogcowFix:    Rebuild and install lib/libc
2091.13Sdogcow
2101.19ScgdSymptom:usr.sbin/config fails to build.
2111.19ScgdFix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
2121.13Sdogcow
2131.19ScgdSymptom:undefined reference to `getprogname' or `setprogname'
2141.19ScgdFix:    Rebuild and install lib/libc
215