UPDATING revision 1.18
11.18Sjmc$NetBSD: UPDATING,v 1.18 2001/02/20 06:00:54 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.18Sjmc
111.18Sjmc20010219:
121.18Sjmc	get/setprogname() added. Any hostprog's that may use this will need
131.18Sjmc        to be bootstraped manually until the host system is current.
141.18Sjmc
151.18Sjmc        Known problems: sys/arch/macppc/stand/fixcoff
161.15Schristos
171.15Schristos20010204:
181.15Schristos	prepare the code to compile with stricter gcc flags. in
191.15Schristos	particular start eliminating redundant declarations. Yacc
201.15Schristos	needs to be installed before make build.
211.10Schristos
221.10Schristos20010114:
231.10Schristos	introduce .if commands(target) in make(1). You need to
241.10Schristos	bring everything up-to-date first, then without installing
251.10Schristos	anything make and install in /usr/bin/make, then proceed
261.10Schristos	with make build.
271.9Ssommerfe
281.9Ssommerfe20010101:
291.9Ssommerfe	bsd.subdir.mk committed 20001230 had a bug which caused
301.9Ssommerfe	afterinstall targets to run too soon; update again.
311.8Ssommerfe
321.8Ssommerfe20001230:
331.8Ssommerfe	New share/mk files needed to support .WAIT in SUBDIR variables.
341.8Ssommerfe	If you get make errors, 
351.8Ssommerfe		(cd share/mk; make install)
361.8Ssommerfe	Also, PRINTOBJDIR has changed and is now used more heavily.
371.6Sad
381.6Sad20001019:
391.7Sad	The `ca' device driver has been replaced by `ld'; although the
401.6Sad	major and minor numbers haven't changed, you should update your /dev
411.6Sad	directory.
421.1Sabs
431.4Sitojun20000929:
441.4Sitojun	The following make directives are obsoleted.
451.4Sitojun	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
461.4Sitojun	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
471.16Swiz	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
481.4Sitojun	additional library libcrypto_{idea,rc5}.
491.4Sitojun
501.1Sabs20000623:
511.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
521.1Sabs	'cd share/mk ; make install' needed before make build.
531.1Sabs
541.1Sabs
551.1SabsHints for a more successful build:
561.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
571.2Smrg    Build a new kernel first:
581.2Smrg	This makes sure that any new system calls or features
591.2Smrg	   expected by the new userland will be present.  This
601.2Smrg	   helps to avoid critical errors when upgrading.
611.1Sabs    Use object directories:
621.1Sabs	This helps to keep stale object
631.1Sabs	   files from polluting the build if a Makefile "forgets"
641.1Sabs	   about one.  It also makes it easier to clean up after
651.1Sabs	   a build.  It's also necessary if you want to use the
661.1Sabs	   same source tree for multiple machines.
671.1Sabs	   To use object directories:
681.1Sabs	    a) cd /usr/src ; make cleandir
691.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
701.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
711.1Sabs	    d) cd /usr/src ; make build
721.2Smrg	   Note that running "make obj" in a directory will create
731.2Smrg	   in obj.$MACHINE directory.
741.1Sabs    Build to a DESTDIR:
751.1Sabs	This helps to keep old
761.1Sabs	   installed files (especially libraries) from interfering
771.1Sabs	   with the new build.
781.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
791.2Smrg	   variable before running make build.  It should be set to
801.2Smrg	   the pathname of an initially empty directory.
811.1Sabs	   Problems: you might need to update critical utilities
821.1Sabs		without using DESTDIR since nothing is executed
831.1Sabs		from what is installed in DESTDIR.
841.1Sabs		(See critical utils, below)
851.1Sabs    Build often:
861.1Sabs	This keeps critical utilities current enough to not choke
871.1Sabs	on any other part of the source tree that depends on up to
881.1Sabs	date functionality.
891.1Sabs 
901.1SabsWhat to do if things don't work:
911.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
921.1SabsWhen things don't work there is usually a few things that commonly
931.1Sabsshould be done.
941.1Sabs    1)	make includes
951.1Sabs	This should be done automatically by make build.
961.1Sabs    2)  cd share/mk && make install
971.1Sabs	Again, automatically done by make build.
981.1Sabs
991.1SabsFailsafe rebuild of a small part of the tree:
1001.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1011.1SabsTo make sure you rebuild something correctly you want to do
1021.1Sabssomething like the following:
1031.1Sabs    1)  Make sure the includes and .mk files are up to date.
1041.1Sabs    2)  Make sure any program used to build the particular
1051.1Sabs	utility is up to date.  (yacc, lex, etc...)
1061.1Sabs    3)  cd ...path/to/util...
1071.1Sabs	make cleandir
1081.1Sabs	rm ...all obj directories...
1091.1Sabs	make cleandir			# yes, again
1101.1Sabs	make obj
1111.1Sabs	make depend && make
1121.1Sabs
1131.1SabsFailsafe rebuild of the entire tree:
1141.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1151.1SabsIf you really want to make sure the source tree is clean and
1161.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
1171.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
1181.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
1191.1Sabs
1201.1Sabs---cut here---
1211.1Sabs#!/bin/sh
1221.1Sabs. /etc/mk.conf
1231.1Sabs
1241.1Sabsif [ -z $BSDSRCDIR ] ; then
1251.1Sabs    BSDSRCDIR=/usr/src
1261.1Sabsfi
1271.1Sabsif [ \! -d $BSDSRCDIR ] ; then
1281.1Sabs    echo Unable to find sources
1291.1Sabs    exit 1
1301.1Sabsfi
1311.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
1321.1Sabs
1331.1Sabsif [ -z $BSDOBJDIR ] ; then
1341.1Sabs    BSDOBJDIR=/usr/obj
1351.1Sabsfi
1361.1Sabsif [ -d $BSDOBJDIR ] ; then
1371.1Sabs    rm -rf $BSDOBJDIR
1381.1Sabsfi
1391.1Sabs
1401.1Sabscd $BSDSRCDIR && make cleandir
1411.1Sabs
1421.1Sabs---cut here---
1431.1Sabs
1441.1SabsCritical utilities:
1451.1Sabs^^^^^^^^^^^^^^^^^^^
1461.1Sabs	gnu/usr.bin/egcs
1471.3Sitojun	usr.bin/compile_et
1481.1Sabs	usr.bin/make
1491.1Sabs	usr.bin/yacc
1501.1Sabs	usr.bin/lex
1511.11Slukem	usr.bin/xlint
1521.2Smrg	usr.sbin/config
1531.1Sabs
1541.1SabsOther problems and possibly solutions:
1551.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1561.1SabsSymptom:Unreasonable compiler errors.
1571.1SabsFix:	Rebuild gnu/usr.bin/egcs
1581.1Sabs
1591.1SabsSymptom:Complaints involving a Makefile.
1601.17SerhFix:	Rebuild usr.bin/make:
1611.17Serh	cd usr.bin/make && make && make install
1621.17Serh        Or, a failsafe method if that doesn't work:
1631.17Serh	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
1641.17Serh
1651.1SabsFix:	Make sure .mk files are up to date.
1661.1Sabs	cd share/mk && make install
1671.2Smrg
1681.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
1691.2SmrgFix:	Rebuild usr.sbin/config
1701.1Sabs
1711.1SabsSymptom:
1721.1SabsFix:	Rebuild usr.bin/yacc
1731.1Sabs
1741.1SabsSymptom:
1751.1SabsFix:	Rebuild usr.bin/lex
1761.1Sabs
1771.1SabsSymptom:
1781.1SabsFix:	rm /usr/lib/libbfd.a
1791.4Sitojun
1801.4SitojunSymptom:Obsolete intermediate files are used during compilation
1811.4SitojunFix:	Try the following sequence of commands in the directory in question.
1821.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
1831.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
1841.4Sitojun	may remain.  The command tries to clean everything up)
1851.5Swiz
1861.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
1871.5SwizFix:	Rebuild and install usr.bin/menuc
1881.12Sitojun
1891.12SitojunSymptom:mklocale not found during build in share/locale/ctype
1901.12SitojunFix:	Build and install usr.bin/mklocale
1911.13Sdogcow
1921.13SdogcowSymptom:undefined reference to `__assert13'
1931.13SdogcowFix:    Rebuild and install lib/libc
1941.13Sdogcow
1951.13Sdogcow
196