UPDATING revision 1.123
1$NetBSD: UPDATING,v 1.123 2004/06/13 08:08:43 jmc Exp $
2
3This file (UPDATING) is intended to be a brief reference to recent
4changes that might cause problems in the build process, and a guide for
5what to do if something doesn't work.
6
7For a more detailed description of the recommended way to build NetBSD
8using build.sh, see the BUILDING file.
9
10Note that much of the advice in this UPDATING file was written before
11build.sh existed.  Nevertheless, the advice here may be useful for
12working around specific problems with build.sh.
13
14See also: BUILDING, build.sh, Makefile.
15
16Recent changes:
17^^^^^^^^^^^^^^^
18
1920040516:
20	The end-user modifiable X11 configuration has been moved
21	from /usr/X11R6/lib/X11/<dir> to /etc/X11/<dir>.
22	Ensure that src and xsrc is up to date, and run
23	"make cleandir" in src/x11 before your next build.
24
2520040426:
26	Support for the original dynamic sysctl node structure has
27	been removed in favor of the newer layout.  This affects
28	consumers of the create and delete interface, as well as
29	the dynamic discovery mechanism.  This is believed only to
30	be the sysctl(8) binary itself, at this point in time, so
31	the only effect of this should be that a sysctl binary
32	built from sources dated between 2003/12/04 and 2004/03/24
33	will not work on a kernel built from sources dated after
34	2004/04/25.  If you need a new sysctl binary but build.sh
35	does not work, make sure that your revision of
36	src/sys/sys/sysctl.h is 1.112 (or later), and then the
37	do the following:
38
39	cd /usr/src (or wherever your source tree is)
40	make USETOOLS=no includes
41	cd lib/libc
42	make USETOOLS=no dependall install
43	cd ../../sbin/sysctl
44	make USETOOLS=no dependall install
45
46	If you are using older sysctl binary, GNU autoconf would fail to
47	identify your machine architecture, and tries to build binary for
48	"unknown-unknown-netbsd20F" or something like that.  if that happens,
49	make sure to follow the above steps.
50
5120040425:
52	The ffs superblock issues listed below under 20040109 and 20030402
53	are now automatically addressed by the /etc/rc.d/fixsb script or by
54	sysinst when it checks a a filesystem. The manual fsck_ffs -b16 -c4
55	invocation mentioned below will continue to work and is now
56	automated by those scripts.  Note that under certain circumstances,
57	affected filesystems upgraded to a -current kernel first before
58	upgrading their userland with the fixsb and fsck_ffs fixes may
59	encounter a 'freeing free inode' panic when writing to the affected
60	filesystem, so it is a good idea to repair the filesystem as soon as
61	possible.  For more details on the fixsb script, see pr install/25138.
62
6320040418:
64	statfs(2) and friends have been replaced with statvfs(2). Before
65	installing a newly build userland make sure that you are running
66	a newly built kernel with COMPAT_20 set. In addition your libc
67	build might not work (undefined SYS_statfs symbol) because make
68	clean does not know how to remove files it does not know about
69	anymore. Manually remove all generated .S sources and objects
70	from the libc build directory.
71
7220040326:
73	The method by which athhal-elf.o gets pulled into i386 kernel builds
74	has been changed. The file is now stored as a uuencoded file in CVS
75	and the generated Makefile will use the new .uue rules from bsd.file.mk
76	to build it.
77
78	This means you must have the latest bsd.files.mk installed when
79	building a kernel without USETOOLS=yes.
80
8120040318:
82	A bug in the cgd(4) blowfish code was corrected, without
83	provision of backwards compatibility, after several public
84	notices over several months. Users of cgd with blowfish cipher
85	ONLY must dump their data before updating their kernels, and
86	recreate cgd's and restore data using the new kernel. See
87	(recent message to current-users, URL when mail-index has updated)
88
8920040313:
90	On acorn32, the opms and qms drivers have been withdrawn, and
91	the old wsqms driver is now called qms.  Kernel config files
92	will need updating.  See the ones in sys/arch/acorn32/conf
93	for examples.
94
9520040125:
96	On acorn32, the beep and sysbeep devices are no longer
97	needed, and will need to be deleted from kernel configuration
98	files.
99
10020040109:
101	Compatibility for old ffs superblock layouts has been
102	added, and the restrictive fsck checks have been reenabled
103	when using those layouts.  If you have been using -current
104	since 20030402, you may find that fsck again signals fatal
105	superblock mismatches.  To repair, make sure you have
106	an updated fsck_ffs and then you can use fsck_ffs -b 16 -c 4
107	to complete the filesystem upgrade.  A message has
108	been added to the kernel which should detect this problem.
109	See the following discussion for more information:
110	http://mail-index.NetBSD.org/current-users/2004/01/11/0022.html
111
11220031203:
113	New binutils builds may fail due to old dependencies.
114	It's necessary to "make cleandir" to ensure that
115	the dependencies will be rebuilt correctly.
116
11720031111:
118	A newer mkdep is needed.  Error noting that is
119		cc: Ambiguous abbreviation --
120
12120031008:
122	/usr/include/sys/disklabel_mbr.h was removed.
123	It's necessary to "make cleandir" to ensure that
124	the dependencies will be rebuilt correctly.
125
12620031007:
127	A sign exension bug was fixed which set all the high bits
128	of our newly expanded ffs fs_flags.  This should only
129	affect users who installed or upgraded in September of 2003.
130	A small utility program was posted to tech-kern which
131	should fix this problem, and a warning message was added
132	to the kernel which should discover and warn about it.  See
133	http://mail-index.NetBSD.org/tech-kern/2003/10/07/0005.html
134
13520030906:
136	With the addition of siginfo support the old signal trampoline
137	code has been deprecated to COMPAT_16. Make sure that your running
138	kernel has COMPAT_16 enabled before building userland.
139
14020030801:
141	With the new openssl, there is some header and library shuffling.
142	rm -f /usr/include/des.h /usr/include/kerberosIV/* /lib/libdes* \
143	/usr/lib/libdes* before building.
144
14520030703:
146	Texinfo was updated to 4.6.  To avoid failures when trying to
147	build the included texinfo files, do:
148
149	cd src/gnu/usr.bin/texinfo
150	make MKINFO=no dependall install
151
15220030630:
153	Groff was updated to 1.19; it's probably necessary to do
154		cd share/mk && make install
155		cd src/gnu/usr.bin/groff
156		make MKMAN=no dependall install
157	(untested).
158
15920030516:
160	Due to bugs in the export handling code, invalid export lines
161	were accepted before and caused the kernel to panic when
162	mountd got restarted because it freed memory that had already
163	been freed. This has been fixed and the kernel checks
164	export addresses very strictly. If you upgrade your kernel,
165	make sure you also upgrade mountd, because if your export
166	file contains lines with an old inet4 address syntax (i.e.
167	a.b.c or a.b or a), they will get rejected by the new kernel.
168
16920030402:
170	The superblock layout for FFS was changed.  If you have 1.6
171	fsck binaries, they will signal a fatal superblock mismatch
172	with the first alternate, because they compare too many
173	fields (even ones that aren't useful).  If possible, upgrade
174	your fsck_ffs binary before using a new kernel.
175	None of this signals actual filesystem damage.
176
17720030324:
178	sendmail version 8.12.8 was imported.  Since sendmail is
179	now setgid to the smmsp group, and runs in "collection"
180	mode for most common activities, there is a new config
181	file called submit.cf that needs to live in /etc/mail.
182	The generic submit.cf sample in /usr/share/sendmail/cf
183	is named netbsd-msp.cf.  Upgrading your regular sendmail
184	configuration file is also strongly advised.
185
186	See the section named "MESSAGE SUBMISSION PROGRAM" in
187	the updated /usr/share/sendmail/README file for more
188	information.
189
19020030117:
191	Texinfo was updated to 4.3.  To avoid failures when trying to
192	build the included texinfo files, do:
193
194	cd src/gnu/usr.bin/texinfo
195	make MKINFO=no dependall install
196
19720021223:
198	The METALOG format changed slightly, to remove the leading
199	"${DESTDIR}" from path names.
200	This only affects people building with UNPRIVED.
201	For complete safety, remove the DESTDIR entirely and
202	update tools/mtree, before running make build.
203
20420021219:
205	CVS repository layout was changed.  See the following for details
206	if you are using (anonymous) cvs to update your tree.
207
208	http://mail-index.NetBSD.org/netbsd-announce/2002/12/19/0000.html
209
21020021219:
211	install(1) had a '-N dbdir' option added, to specify an
212	alternate location to look up users & groups (instead
213	of the host system passwd(5) and group(5) databases).
214
215	The build system was modified to take advantage of
216	this option (using ${NETBSDSRCDIR}/etc), so if you
217	use USETOOLS==no, you may have to rebuild and
218	reinstall usr.bin/xinstall first.
219
22020021130:
221	fparseln(3) moved from libutil to libc.
222	If building to DESTDIR=/, reinstall the includes
223	and rebuild libc:
224		make includes
225		make do-lib-libc
226	If using build.sh, "cd tools/compat && make clean"
227	before rebuilding the tools.
228
22920021126:
230	The mk.conf(5) variable SYS_INCLUDE has been deprecated,
231	including the optional "SYS_INCLUDE=symlinks" support.
232	All header files, including <sys/*.h> are copied into
233	/usr/include.
234
23520021121:
236	The C run-time support files crtbegin.o and crtend.o
237	(and their companions crtbeginS.o and crtendS.o) were
238	split up, with new crti.o and crtn.o files resulting.
239	This means that libtool needs to be rebuilt once the
240	new libraries are installed.  The process of rebuilding
241	libtool will cause it to automatically notice the new
242	required files, but it *must* be rebuilt in order to
243	do this.
244
245	An out-of-date libtool will result in shared libraries
246	which lack _init() and _fini() routines, which means that
247	their global contructors/destructors will not be invoked.
248
24920021121:
250	A bug related to how ARM ELF objects were tagged has been
251	corrected.
252
253	NetBSD ARM ELF uses the soft-VFP floating point model by
254	default.  However, the assembler lacked support for marking
255	objects as using the VFP floating point format, and the
256	compiler was not properly passing the flag indicating "soft-VFP"
257	to the assembler.
258
259	Unfortunately, this means that the linker will now consider
260	old (i.e. not marked "softvfp") NetBSD ARM ELF objects to be
261	incompatible with new (properly marked) objects.
262
263	The problem will only manifest itself if you attempt to compile
264	a new program using the fixed toolchain, and link that program
265	against old libraries which do not have the proper "softvfp"
266	markings.  ALL OF YOUR EXISTING BINARIES AND SHARED LIBRARIES
267	WILL CONTINUE TO WORK PROPERLY.
268
269	The only work-around for the problem is to recompile all of
270	the libraries on the system.  The easiest way to do this for
271	system libraries is to install a binary snapshot; they are
272	generally available on releng.NetBSD.org.  Any packages you
273	have installed which supply libraries will have to be recompiled
274	if you wish to link new programs against those libraries.
275
276	If you have questions about this matter, please contact
277	port-arm@NetBSD.org.
278
27920021011:
280	Systrace has been improved to support privilege elevation.
281	Updating the kernel requires the userland part of systrace
282	to be rebuilt.
283
28420021010:
285	The config(8) grammar was changed to allow options to register
286	dependencies on attributes, as well as other options.  Users
287	must update and reinstall usr.sbin/config before building a new
288	kernel.
289
29020021009:
291	A new attribute dependency syntax was introduced to config(8),
292	which is now used by the SCSI configuration description.  Users
293	must update and reinstall usr.sbin/config before building a new
294	kernel.
295
29620021003:
297	Several changes have been made to the autoconfiguration
298	framework.  Users must update and reinstall usr.sbin/config
299	before building a new kernel.
300
30120021001:
302	The i386mp branch has been merged.  To compile a kernel, users
303	will need to add the option 'cpu* at mainbus?' to their configuration
304	file.  Multiprocessor kernels will need
305	ioapic*		at mainbus? apid ?
306	options		MULTIPROCESSOR
307	options		COM_MPLOCK
308
30920020922:
310	MKDYNAMICROOT=yes enabled by default, which means that
311	certain shared libraries are installed into /lib, the shared
312	linker is installed into /libexec, and all programs in /bin
313	and /sbin are dynamically linked.
314	If you do not use "make build", you should ensure that
315	you have the libraries and shared linker in the new locations,
316	with:
317		make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so
318
31920020917:
320	USE_NEW_TOOLCHAIN has been replaced with:
321	    -	TOOLCHAIN_MISSING -- set to "yes" on platforms for which
322		there is no working in-tree toolchain (hppa, ns32k, sh5,
323		x86_64).
324	    -	EXTERNAL_TOOLCHAIN -- if defined by the user, points to the
325		root of an external toolchain (e.g. /usr/local/gnu).  This
326		enables the cross-build framework even for TOOLCHAIN_MISSING
327		platforms.
328
32920020906:
330	gehenna-devsw has been merged into the trunk. Need to update and
331	reinstall usr.sbin/config before building the kernel.
332
33320020822:
334	Crunched rescue tools (contents of /bin and /sbin, plus others)
335	are now provided in /rescue.
336
337	To ensure that these are built statically linked (no matter
338	what the setting of LDSTATIC is), use a crunchgen(1) built
339	from sources newer than 20020820 (see the next entry).
340
34120020820:
342	crunchgen(1) changed to ensure that the generated program
343	is statically linked.
344
345	Solution: update and reinstall usr.bin/crunch
346
34720020605:
348	smmsp user/group has been added for sendmail.
349
350	Add the following into /etc/group:
351
352	smmsp:*:17:
353
354	and the following to /etc/master.passwd (via vipw):
355
356	smmsp:*:17:17::0:0:Sendmail Message Submission Program:/nonexistent:/sbin/nologin
357
35820020515:
359	sshd user/group has been added.  Need to hand add this in, or sshd
360	will not let you log in (with default, or UsePrivlegeSeparation=yes)
361
362	Add the following into /etc/group:
363
364	sshd:*:16:
365
366	and the following to /etc/master.passwd (via vipw):
367
368	sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
369	
370	Also /var/chroot/sshd directory needs to be present (digged as part of
371	the build process).
372
37320020426:
374	NBUILDJOBS obsoleted in favor of just using -j.
375
37620020426:
377	etc/postinstall added, which performs various checks for 
378	configuration file updates and changes, and can fix most of
379	the problems identified.
380	This should make it much easier to upgrade a system's
381	configuration from earlier systems (as far back as NetBSD 1.5).
382
38320020320:
384	<bsd.lib.mk> needs a new install(1) for its "-a cmd" support.
385	Build and install at usr.bin/xinstall before the build.
386
38720020319:
388	Raw IPv6 socket now makes strict checking for sa_family and sa_len
389	on send(2) operation.  Be sure to have sbin/rtsol and usr.sbin/rtsold
390	newer than November 2001 when you upgrade the kernel.
391
39220020311:
393	ssh configuration files were moved from /etc to /etc/ssh.  Beware
394	if you restart your machine from remote.  Note that sshd.conf needs
395	to be changed (due to the use of "/etc" inside).
396
39720020223:
398	Users of the VAX port will need to rebuild and install gas
399	so it deal with the now present register prefix used in all
400	the VAX assembly files.
401
40220020118:
403	ntpd user/group has been added.  Need to hand add this in or builds
404	will break as mtree aborts early.
405
406	Add the following into /etc/group:
407
408	ntpd:*:15:
409
410	and the following to /etc/master.passwd (via vipw):
411
412	ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
413
41420011207:
415	If you're attempting to build a snapshot on sparc64 and are getting
416	reloc errors from the toolchain groff binary this means your native
417	toolchain has some broken C++ bits.
418
419	To fix:
420
421	Build a new toolchain (i.e. build.sh -t)
422	Use the new toolchain to build and install natively (i.e. /usr/lib)
423
424	gnu/lib/libgcc
425	gnu/lib/libstdc++
426
427	After this a snapshot will be able to be built.
428
42920011201:
430	In order for a sparc64 build to work you must have a working awk. If
431	you've built and installed a system with the new toolchain up to this
432	point you do not have a working awk as its ability to do floating
433	point is broken. 
434
435	To build:
436
437	remake and install gnu/lib/libgcc
438	remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
439	against the new libgcc.a)
440
44120011128:
442	Kernel config information was changed to use defflag in
443	the various "files" files.  Bug fixes to config(8) are
444	required in order for this to work properly.  Make sure
445	to build and install in usr.sbin/config before attempting
446	to build a new kernel.
447
44820011030:
449	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
450	before building libc.
451
45220011029:
453	The new document BUILDING.mdoc (view with nroff | more, or
454	see pre-generated .txt and .html versions) describes the build
455	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
456	build process, are intended in the long run to replace this
457	manual update log.
458
459	Users building a USE_NEW_TOOLCHAIN system should read the
460	BUILDING document for caveats.  Generally, BUILDING supersedes
461	UPDATING for these systems, as tool updating is taken care of
462	by the new build system.
463
46420011028:
465	src/etc/Makefile now needs install to be able to handle
466	symlinks that point to nowhere. A bug in install that
467	prevented this was corrected.
468
469	Solution: update and reinstall usr.bin/xinstall
470	Better Solution: Use the new toolchain and it will just work
471	for you.
472
47320011006:
474	/etc/mtree/NetBSD.dist has been updated to take advantage of
475	absolute path support added to mtree(8). Older mtree(8)s don't
476	understand the format.
477
478	Solution: update and reinstall usr.sbin/mtree
479
48020011004:
481	Crunchgen has been updated to work via reach-over makefiles. Updating
482	is suggested before running a snapshot build
483
48420010915:
485	The new "ubcperf" code committed by Chuck Silvers removed
486	a header file, uvm/uvm_vnode.h.  There may be stale .depend
487	files that still reference this file.
488
489	Solution: "make cleandir && make dependall" in affected
490	directories.
491
49220010803:
493	grep.info is now built from grep.texi using makeinfo.  Since it
494	requires makeinfo v4.0, you need to install new texinfo before
495	building gnu/usr.bin/grep.  To install new texinfo, please follow
496	the instruction described in 20010726 entry.
497
49820010803: 
499	(i386 only): i386 kernel now uses new instructions like
500	`fxsave' which old gas doesn't understand.  To build the
501	kernel successfully, you need to build and install a new toolchain, 
502	(i.e., build.sh -t) or 	(temporarily) comment out "options I686_CPU" 
503	from your kernel configuration until you rebuild your userland.
504	See 20011029 above and BUILDING file in this directory for more information.
505	[updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
506
50720010731:
508	Bootloader update on ELF platforms.  DDB in kernels from before
509	this will be unable to read symbol tables provided by newer
510	bootloaders.
511
51220010726:
513	Texinfo was updated to 4.0.  To avoid failures when trying to
514	build the included texinfo files, do:
515
516	cd src/gnu/usr.bin/texinfo
517	make MKINFO=no dependall install
518
51920010718:
520	Enabled correct .init/.fini processing in crt0.  The way this
521	was done was to change a -I directive to cc(1), which means
522	make(1) will have a stale dependency (it will be checking the
523	timestamp on the wrong "dot_init.h").
524
525	The symptom you will see is that new programs die with SIGSEGV
526	if you have a stale dependency.
527
528	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
529	before starting your build.
530
53120010628:
532	A construct was added to uvm_page.h that uncovered a bug
533	in lint(1).  If you get a warning/error about a non-portable
534	bitfield, update your lint(1) before proceeding.
535
53620010226:
537	Added named user/group to system. Need to hand add this in or builds
538	will break as mtree aborts early.
539
540	To work around add by hand:
541
542	named:*:14:
543
544	to /etc/group and add:
545
546	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
547
548	to master.passwd (use vipw for instance if doing by hand).
549
550	Now a make build should progress.
551
55220010219:
553	get/setprogname() added. Any hostprogs that may use this will need
554	to be bootstrapped manually until the host system is current.
555
556	Known problems: sys/arch/macppc/stand/fixcoff
557			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
558			  CFLAGS and rebuilding should work)
559			usr.sbin/mdsetimage - Build a static copy if
560			  building a snapshot before fully bootstrapped.
561
56220010204:
563	prepare the code to compile with stricter gcc flags. in
564	particular start eliminating redundant declarations. Yacc
565	needs to be installed before make build.
566
56720010114:
568	introduce .if commands(target) in make(1). You need to
569	bring everything up-to-date first, then without installing
570	anything make and install in usr.bin/make, then proceed
571	with make build.
572
57320010101:
574	bsd.subdir.mk committed 20001230 had a bug which caused
575	afterinstall targets to run too soon; update again.
576
57720001230:
578	New share/mk files needed to support .WAIT in SUBDIR variables.
579	If you get make errors, 
580		(cd share/mk; make install)
581	Also, PRINTOBJDIR has changed and is now used more heavily.
582
58320001019:
584	The `ca' device driver has been replaced by `ld'; although the
585	major and minor numbers haven't changed, you should update your /dev
586	directory.
587
58820000929:
589	The following make directives are obsoleted.
590	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
591	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
592	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
593	additional library libcrypto_{idea,rc5}.
594
595
596Hints for a more successful build:
597^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
598    Use build.sh, but do not use its "expert mode":
599	This will will automatically build the tools in the
600	   correct order, and it will keep the tools and the
601	   new build products from interfering with the running
602	   system.  This will allow you to ignore most of the
603	   other advice in this file.
604    Build a new kernel first:
605	This makes sure that any new system calls or features
606	   expected by the new userland will be present.  This
607	   helps to avoid critical errors when upgrading.
608    Use object directories:
609	This helps to keep stale object
610	   files from polluting the build if a Makefile "forgets"
611	   about one.  It also makes it easier to clean up after
612	   a build.  It's also necessary if you want to use the
613	   same source tree for multiple machines.
614	   To use object directories with build.sh:
615	    a) invoke build.sh with the "-M" or "-O" options.
616	   To use object directories without using build.sh:
617	    a) cd /usr/src ; make cleandir
618	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
619	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
620	    d) cd /usr/src ; make build
621	   Note that running "make obj" in a directory will create
622	   in obj.$MACHINE directory.
623    Build to a DESTDIR:
624	This helps to keep old installed files (especially libraries)
625	   from interfering with the new build.
626	   To build to a DESTDIR with build.sh, use the "-D" option.
627	   To build to a DESTDIR without using build.sh, set the DESTDIR
628	   environment variable before running make build.  It should be
629	   set to the pathname of an initially empty directory.
630	   Problems: if you do not use build.sh, you might need to
631		update critical utilities without using DESTDIR since
632		nothing is executed from what is installed in DESTDIR.
633		(See critical utils, below.)
634    Build often:
635	This keeps critical utilities current enough to not choke
636	on any other part of the source tree that depends on up to
637	date functionality.  If you use build.sh, you should not have
638	this problem.
639 
640What to do if things don't work:
641^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
642When things don't work there is usually a few things that commonly
643should be done.
644    1)	make includes
645	This should be done automatically by make build.
646    2)  cd share/mk && make install
647	Again, automatically done by make build.
648
649Failsafe rebuild of a small part of the tree:
650^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
651To make sure you rebuild something correctly you want to do
652something like the following:
653    1)  Make sure the includes and .mk files are up to date.
654    2)  Make sure any program used to build the particular
655	utility is up to date.  (yacc, lex, etc...)
656    3)  cd ...path/to/util...
657	make cleandir
658	rm ...all obj directories...
659	make cleandir			# yes, again
660	make obj
661	make depend && make
662
663Failsafe rebuild of the entire tree:
664^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
665If you really want to make sure the source tree is clean and
666ready for a build try the following.  Note that sourcing /etc/mk.conf
667(a make(1) Makefile) in this manner is not right, and will not work
668for anyone who uses any make(1) features in /etc/mk.conf.
669
670---cut here---
671#!/bin/sh
672. /etc/mk.conf
673
674if [ -z $NETBSDSRCDIR ] ; then
675    NETBSDSRCDIR=/usr/src
676fi
677if [ \! -d $NETBSDSRCDIR ] ; then
678    echo Unable to find sources
679    exit 1
680fi
681find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
682
683if [ -z $BSDOBJDIR ] ; then
684    BSDOBJDIR=/usr/obj
685fi
686if [ -d $BSDOBJDIR ] ; then
687    rm -rf $BSDOBJDIR
688fi
689
690cd $NETBSDSRCDIR && make cleandir
691
692---cut here---
693
694Critical utilities:
695^^^^^^^^^^^^^^^^^^^
696	gnu/usr.bin/egcs
697	usr.bin/compile_et
698	usr.bin/make
699	usr.bin/yacc
700	usr.bin/lex
701	usr.bin/xlint
702	usr.sbin/config
703
704Other problems and possible solutions:
705^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
706Symptom:Unreasonable compiler errors.
707Fix:	Rebuild gnu/usr.bin/egcs
708
709Symptom:Complaints involving a Makefile.
710Fix:	Rebuild usr.bin/make:
711	cd usr.bin/make && make && make install
712	Or, a failsafe method if that doesn't work:
713	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
714
715Fix:	Make sure .mk files are up to date.
716	cd share/mk && make install
717
718Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
719Fix:	Rebuild usr.sbin/config
720
721Symptom:
722Fix:	Rebuild usr.bin/yacc
723
724Symptom:
725Fix:	Rebuild usr.bin/lex
726
727Symptom:
728Fix:	rm /usr/lib/libbfd.a
729
730Symptom:Obsolete intermediate files are used during compilation
731Fix:	Try the following sequence of commands in the directory in question.
732	make cleandir; rm `make print-objdir`; make cleandir; make obj
733	(If you built the tree without "make obj" in the past, obsolete files
734	may remain.  The command tries to clean everything up)
735
736Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
737Fix:	Rebuild and install usr.bin/menuc
738
739Symptom:mklocale not found during build in share/locale/ctype
740Fix:	Build and install usr.bin/mklocale
741
742Symptom:undefined reference to `__assert13' or `__unsetenv13'
743Fix:    Rebuild and install lib/libc
744
745Symptom:usr.sbin/config fails to build.
746Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
747
748Symptom:undefined reference to `getprogname' or `setprogname'
749Fix:    Rebuild and install lib/libc
750
751Symptom:lint does not understand the '-X' option
752Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
753