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