UPDATING revision 1.15
11.15Schristos$NetBSD: UPDATING,v 1.15 2001/02/04 19:50:26 christos 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.15Schristos
111.15Schristos20010204:
121.15Schristos	prepare the code to compile with stricter gcc flags. in
131.15Schristos	particular start eliminating redundant declarations. Yacc
141.15Schristos	needs to be installed before make build.
151.10Schristos
161.10Schristos20010114:
171.10Schristos	introduce .if commands(target) in make(1). You need to
181.10Schristos	bring everything up-to-date first, then without installing
191.10Schristos	anything make and install in /usr/bin/make, then proceed
201.10Schristos	with make build.
211.9Ssommerfe
221.9Ssommerfe20010101:
231.9Ssommerfe	bsd.subdir.mk committed 20001230 had a bug which caused
241.9Ssommerfe	afterinstall targets to run too soon; update again.
251.8Ssommerfe
261.8Ssommerfe20001230:
271.8Ssommerfe	New share/mk files needed to support .WAIT in SUBDIR variables.
281.8Ssommerfe	If you get make errors, 
291.8Ssommerfe		(cd share/mk; make install)
301.8Ssommerfe	Also, PRINTOBJDIR has changed and is now used more heavily.
311.6Sad
321.6Sad20001019:
331.7Sad	The `ca' device driver has been replaced by `ld'; although the
341.6Sad	major and minor numbers haven't changed, you should update your /dev
351.6Sad	directory.
361.1Sabs
371.4Sitojun20000929:
381.4Sitojun	The following make directives are obsoleted.
391.4Sitojun	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
401.4Sitojun	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
411.4Sitojun	bulit into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
421.4Sitojun	additional library libcrypto_{idea,rc5}.
431.4Sitojun
441.1Sabs20000623:
451.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
461.1Sabs	'cd share/mk ; make install' needed before make build.
471.1Sabs
481.1Sabs
491.1SabsHints for a more successful build:
501.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
511.2Smrg    Build a new kernel first:
521.2Smrg	This makes sure that any new system calls or features
531.2Smrg	   expected by the new userland will be present.  This
541.2Smrg	   helps to avoid critical errors when upgrading.
551.1Sabs    Use object directories:
561.1Sabs	This helps to keep stale object
571.1Sabs	   files from polluting the build if a Makefile "forgets"
581.1Sabs	   about one.  It also makes it easier to clean up after
591.1Sabs	   a build.  It's also necessary if you want to use the
601.1Sabs	   same source tree for multiple machines.
611.1Sabs	   To use object directories:
621.1Sabs	    a) cd /usr/src ; make cleandir
631.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
641.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
651.1Sabs	    d) cd /usr/src ; make build
661.2Smrg	   Note that running "make obj" in a directory will create
671.2Smrg	   in obj.$MACHINE directory.
681.1Sabs    Build to a DESTDIR:
691.1Sabs	This helps to keep old
701.1Sabs	   installed files (especially libraries) from interfering
711.1Sabs	   with the new build.
721.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
731.2Smrg	   variable before running make build.  It should be set to
741.2Smrg	   the pathname of an initially empty directory.
751.1Sabs	   Problems: you might need to update critical utilities
761.1Sabs		without using DESTDIR since nothing is executed
771.1Sabs		from what is installed in DESTDIR.
781.1Sabs		(See critical utils, below)
791.1Sabs    Build often:
801.1Sabs	This keeps critical utilities current enough to not choke
811.1Sabs	on any other part of the source tree that depends on up to
821.1Sabs	date functionality.
831.1Sabs 
841.1SabsWhat to do if things don't work:
851.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
861.1SabsWhen things don't work there is usually a few things that commonly
871.1Sabsshould be done.
881.1Sabs    1)	make includes
891.1Sabs	This should be done automatically by make build.
901.1Sabs    2)  cd share/mk && make install
911.1Sabs	Again, automatically done by make build.
921.1Sabs
931.1SabsFailsafe rebuild of a small part of the tree:
941.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
951.1SabsTo make sure you rebuild something correctly you want to do
961.1Sabssomething like the following:
971.1Sabs    1)  Make sure the includes and .mk files are up to date.
981.1Sabs    2)  Make sure any program used to build the particular
991.1Sabs	utility is up to date.  (yacc, lex, etc...)
1001.1Sabs    3)  cd ...path/to/util...
1011.1Sabs	make cleandir
1021.1Sabs	rm ...all obj directories...
1031.1Sabs	make cleandir			# yes, again
1041.1Sabs	make obj
1051.1Sabs	make depend && make
1061.1Sabs
1071.1SabsFailsafe rebuild of the entire tree:
1081.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1091.1SabsIf you really want to make sure the source tree is clean and
1101.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
1111.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
1121.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
1131.1Sabs
1141.1Sabs---cut here---
1151.1Sabs#!/bin/sh
1161.1Sabs. /etc/mk.conf
1171.1Sabs
1181.1Sabsif [ -z $BSDSRCDIR ] ; then
1191.1Sabs    BSDSRCDIR=/usr/src
1201.1Sabsfi
1211.1Sabsif [ \! -d $BSDSRCDIR ] ; then
1221.1Sabs    echo Unable to find sources
1231.1Sabs    exit 1
1241.1Sabsfi
1251.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
1261.1Sabs
1271.1Sabsif [ -z $BSDOBJDIR ] ; then
1281.1Sabs    BSDOBJDIR=/usr/obj
1291.1Sabsfi
1301.1Sabsif [ -d $BSDOBJDIR ] ; then
1311.1Sabs    rm -rf $BSDOBJDIR
1321.1Sabsfi
1331.1Sabs
1341.1Sabscd $BSDSRCDIR && make cleandir
1351.1Sabs
1361.1Sabs---cut here---
1371.1Sabs
1381.1SabsCritical utilities:
1391.1Sabs^^^^^^^^^^^^^^^^^^^
1401.1Sabs	gnu/usr.bin/egcs
1411.3Sitojun	usr.bin/compile_et
1421.1Sabs	usr.bin/make
1431.1Sabs	usr.bin/yacc
1441.1Sabs	usr.bin/lex
1451.11Slukem	usr.bin/xlint
1461.2Smrg	usr.sbin/config
1471.1Sabs
1481.1SabsOther problems and possibly solutions:
1491.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1501.1SabsSymptom:Unreasonable compiler errors.
1511.1SabsFix:	Rebuild gnu/usr.bin/egcs
1521.1Sabs
1531.1SabsSymptom:Complaints involving a Makefile.
1541.14ShubertfFix:	Rebuild usr.bin/make
1551.1SabsFix:	Make sure .mk files are up to date.
1561.1Sabs	cd share/mk && make install
1571.2Smrg
1581.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
1591.2SmrgFix:	Rebuild usr.sbin/config
1601.1Sabs
1611.1SabsSymptom:
1621.1SabsFix:	Rebuild usr.bin/yacc
1631.1Sabs
1641.1SabsSymptom:
1651.1SabsFix:	Rebuild usr.bin/lex
1661.1Sabs
1671.1SabsSymptom:
1681.1SabsFix:	rm /usr/lib/libbfd.a
1691.4Sitojun
1701.4SitojunSymptom:Obsolete intermediate files are used during compilation
1711.4SitojunFix:	Try the following sequence of commands in the directory in question.
1721.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
1731.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
1741.4Sitojun	may remain.  The command tries to clean everything up)
1751.5Swiz
1761.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
1771.5SwizFix:	Rebuild and install usr.bin/menuc
1781.12Sitojun
1791.12SitojunSymptom:mklocale not found during build in share/locale/ctype
1801.12SitojunFix:	Build and install usr.bin/mklocale
1811.13Sdogcow
1821.13SdogcowSymptom:undefined reference to `__assert13'
1831.13SdogcowFix:    Rebuild and install lib/libc
1841.13Sdogcow
1851.13Sdogcow
186