UPDATING revision 1.25
11.25Sthorpej$NetBSD: UPDATING,v 1.25 2001/07/23 05:49:09 thorpej 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.25Sthorpej
111.25Sthorpej20010718:
121.25Sthorpej
131.25Sthorpej	Enabled correct .init/.fini processing in crt0.  The way this
141.25Sthorpej	was done was to change a -I directive to cc(1), which means
151.25Sthorpej	make(1) will have a stale dependency (it will be checking the
161.25Sthorpej	timestamp on the wrong "dot_init.h").
171.25Sthorpej
181.25Sthorpej	The symptom you will see is that new programs die with SIGSEGV
191.25Sthorpej	if you have a stale dependency.
201.25Sthorpej
211.25Sthorpej	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
221.25Sthorpej	before starting your build.
231.21Sjmc
241.21Sjmc20010226:
251.21Sjmc
261.22Sjmc	Added named user/group to system. Need to hand add this in or builds
271.21Sjmc	will break as mtree aborts early.
281.21Sjmc
291.21Sjmc	To work around add by hand:
301.21Sjmc
311.21Sjmc	named:*:14:
321.21Sjmc
331.22Sjmc	to /etc/group and add:
341.22Sjmc
351.22Sjmc	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
361.22Sjmc
371.22Sjmc	to master.passwd (use vipw for instance if doing by hand).
381.22Sjmc
391.22Sjmc	Now a make build should progress.
401.18Sjmc
411.18Sjmc20010219:
421.18Sjmc	get/setprogname() added. Any hostprog's that may use this will need
431.20Sjmc        to be bootstrapped manually until the host system is current.
441.18Sjmc
451.18Sjmc        Known problems: sys/arch/macppc/stand/fixcoff
461.19Scgd			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
471.19Scgd			  CFLAGS and rebuilding should work)
481.20Sjmc			usr.sbin/mdsetimage - Build a static copy if
491.20Sjmc  		          building a snapshot before fully bootstrapped.
501.15Schristos
511.15Schristos20010204:
521.15Schristos	prepare the code to compile with stricter gcc flags. in
531.15Schristos	particular start eliminating redundant declarations. Yacc
541.15Schristos	needs to be installed before make build.
551.10Schristos
561.10Schristos20010114:
571.10Schristos	introduce .if commands(target) in make(1). You need to
581.10Schristos	bring everything up-to-date first, then without installing
591.23Stron	anything make and install in usr.bin/make, then proceed
601.10Schristos	with make build.
611.9Ssommerfe
621.9Ssommerfe20010101:
631.9Ssommerfe	bsd.subdir.mk committed 20001230 had a bug which caused
641.9Ssommerfe	afterinstall targets to run too soon; update again.
651.8Ssommerfe
661.8Ssommerfe20001230:
671.8Ssommerfe	New share/mk files needed to support .WAIT in SUBDIR variables.
681.8Ssommerfe	If you get make errors, 
691.8Ssommerfe		(cd share/mk; make install)
701.8Ssommerfe	Also, PRINTOBJDIR has changed and is now used more heavily.
711.6Sad
721.6Sad20001019:
731.7Sad	The `ca' device driver has been replaced by `ld'; although the
741.6Sad	major and minor numbers haven't changed, you should update your /dev
751.6Sad	directory.
761.1Sabs
771.4Sitojun20000929:
781.4Sitojun	The following make directives are obsoleted.
791.4Sitojun	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
801.4Sitojun	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
811.16Swiz	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
821.4Sitojun	additional library libcrypto_{idea,rc5}.
831.4Sitojun
841.1Sabs20000623:
851.1Sabs	MKCRYPTO and friends added to share/mk/bsd.own.mk.
861.1Sabs	'cd share/mk ; make install' needed before make build.
871.1Sabs
881.1Sabs
891.1SabsHints for a more successful build:
901.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
911.2Smrg    Build a new kernel first:
921.2Smrg	This makes sure that any new system calls or features
931.2Smrg	   expected by the new userland will be present.  This
941.2Smrg	   helps to avoid critical errors when upgrading.
951.1Sabs    Use object directories:
961.1Sabs	This helps to keep stale object
971.1Sabs	   files from polluting the build if a Makefile "forgets"
981.1Sabs	   about one.  It also makes it easier to clean up after
991.1Sabs	   a build.  It's also necessary if you want to use the
1001.1Sabs	   same source tree for multiple machines.
1011.1Sabs	   To use object directories:
1021.1Sabs	    a) cd /usr/src ; make cleandir
1031.2Smrg	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
1041.2Smrg	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
1051.1Sabs	    d) cd /usr/src ; make build
1061.2Smrg	   Note that running "make obj" in a directory will create
1071.2Smrg	   in obj.$MACHINE directory.
1081.1Sabs    Build to a DESTDIR:
1091.1Sabs	This helps to keep old
1101.1Sabs	   installed files (especially libraries) from interfering
1111.1Sabs	   with the new build.
1121.1Sabs	   To build to a DESTDIR, set the DESTDIR environment
1131.2Smrg	   variable before running make build.  It should be set to
1141.2Smrg	   the pathname of an initially empty directory.
1151.1Sabs	   Problems: you might need to update critical utilities
1161.1Sabs		without using DESTDIR since nothing is executed
1171.1Sabs		from what is installed in DESTDIR.
1181.1Sabs		(See critical utils, below)
1191.1Sabs    Build often:
1201.1Sabs	This keeps critical utilities current enough to not choke
1211.1Sabs	on any other part of the source tree that depends on up to
1221.1Sabs	date functionality.
1231.1Sabs 
1241.1SabsWhat to do if things don't work:
1251.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1261.1SabsWhen things don't work there is usually a few things that commonly
1271.1Sabsshould be done.
1281.1Sabs    1)	make includes
1291.1Sabs	This should be done automatically by make build.
1301.1Sabs    2)  cd share/mk && make install
1311.1Sabs	Again, automatically done by make build.
1321.1Sabs
1331.1SabsFailsafe rebuild of a small part of the tree:
1341.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1351.1SabsTo make sure you rebuild something correctly you want to do
1361.1Sabssomething like the following:
1371.1Sabs    1)  Make sure the includes and .mk files are up to date.
1381.1Sabs    2)  Make sure any program used to build the particular
1391.1Sabs	utility is up to date.  (yacc, lex, etc...)
1401.1Sabs    3)  cd ...path/to/util...
1411.1Sabs	make cleandir
1421.1Sabs	rm ...all obj directories...
1431.1Sabs	make cleandir			# yes, again
1441.1Sabs	make obj
1451.1Sabs	make depend && make
1461.1Sabs
1471.1SabsFailsafe rebuild of the entire tree:
1481.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1491.1SabsIf you really want to make sure the source tree is clean and
1501.2Smrgready for a build try the following.  Note that sourcing /etc/mk.conf
1511.2Smrg(a make(1) Makefile) in this manner is not right, and will not work
1521.2Smrgfor anyone who uses any make(1) features in /etc/mk.conf.
1531.1Sabs
1541.1Sabs---cut here---
1551.1Sabs#!/bin/sh
1561.1Sabs. /etc/mk.conf
1571.1Sabs
1581.1Sabsif [ -z $BSDSRCDIR ] ; then
1591.1Sabs    BSDSRCDIR=/usr/src
1601.1Sabsfi
1611.1Sabsif [ \! -d $BSDSRCDIR ] ; then
1621.1Sabs    echo Unable to find sources
1631.1Sabs    exit 1
1641.1Sabsfi
1651.1Sabsfind $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
1661.1Sabs
1671.1Sabsif [ -z $BSDOBJDIR ] ; then
1681.1Sabs    BSDOBJDIR=/usr/obj
1691.1Sabsfi
1701.1Sabsif [ -d $BSDOBJDIR ] ; then
1711.1Sabs    rm -rf $BSDOBJDIR
1721.1Sabsfi
1731.1Sabs
1741.1Sabscd $BSDSRCDIR && make cleandir
1751.1Sabs
1761.1Sabs---cut here---
1771.1Sabs
1781.1SabsCritical utilities:
1791.1Sabs^^^^^^^^^^^^^^^^^^^
1801.1Sabs	gnu/usr.bin/egcs
1811.3Sitojun	usr.bin/compile_et
1821.1Sabs	usr.bin/make
1831.1Sabs	usr.bin/yacc
1841.1Sabs	usr.bin/lex
1851.11Slukem	usr.bin/xlint
1861.2Smrg	usr.sbin/config
1871.1Sabs
1881.1SabsOther problems and possibly solutions:
1891.1Sabs^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1901.1SabsSymptom:Unreasonable compiler errors.
1911.1SabsFix:	Rebuild gnu/usr.bin/egcs
1921.1Sabs
1931.1SabsSymptom:Complaints involving a Makefile.
1941.17SerhFix:	Rebuild usr.bin/make:
1951.17Serh	cd usr.bin/make && make && make install
1961.17Serh        Or, a failsafe method if that doesn't work:
1971.17Serh	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
1981.17Serh
1991.1SabsFix:	Make sure .mk files are up to date.
2001.1Sabs	cd share/mk && make install
2011.2Smrg
2021.2SmrgSymptom:Kernel `config' fails to configure any kernel, including GENERIC.
2031.2SmrgFix:	Rebuild usr.sbin/config
2041.1Sabs
2051.1SabsSymptom:
2061.1SabsFix:	Rebuild usr.bin/yacc
2071.1Sabs
2081.1SabsSymptom:
2091.1SabsFix:	Rebuild usr.bin/lex
2101.1Sabs
2111.1SabsSymptom:
2121.1SabsFix:	rm /usr/lib/libbfd.a
2131.4Sitojun
2141.4SitojunSymptom:Obsolete intermediate files are used during compilation
2151.4SitojunFix:	Try the following sequence of commands in the directory in question.
2161.4Sitojun	make cleandir; rm `make print-objdir`; make cleandir; make obj
2171.4Sitojun	(If you built the tree without "make obj" in the past, obsolete files
2181.4Sitojun	may remain.  The command tries to clean everything up)
2191.5Swiz
2201.5SwizSymptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
2211.5SwizFix:	Rebuild and install usr.bin/menuc
2221.12Sitojun
2231.12SitojunSymptom:mklocale not found during build in share/locale/ctype
2241.12SitojunFix:	Build and install usr.bin/mklocale
2251.13Sdogcow
2261.13SdogcowSymptom:undefined reference to `__assert13'
2271.13SdogcowFix:    Rebuild and install lib/libc
2281.13Sdogcow
2291.19ScgdSymptom:usr.sbin/config fails to build.
2301.19ScgdFix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
2311.13Sdogcow
2321.19ScgdSymptom:undefined reference to `getprogname' or `setprogname'
2331.19ScgdFix:    Rebuild and install lib/libc
2341.24Sabs
2351.24SabsSymptom:lint does not understand the '-X' option
2361.24SabsFix:    May need to build & install libs with NOLINT=1 before rebuilding lint
237