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