UPDATING revision 1.109
1$NetBSD: UPDATING,v 1.109 2004/03/14 14:56:00 dbj Exp $
2
3This file is intended to be a brief introduction to the build
4process and a reference on what to do if something doesn't work.
5
6For a more detailed description see Makefile.
7
8Recent changes:
9^^^^^^^^^^^^^^^
10
1120040313:
12	On acorn32, the opms and qms drivers have been withdrawn, and
13	the old wsqms driver is now called qms.  Kernel config files
14	will need updating.  See the ones in sys/arch/acorn32/conf
15	for examples.
16
1720040125:
18	On acorn32, the beep and sysbeep devices are no longer
19	needed, and will need to be deleted from kernel configuration
20	files.
21
2220040109:
23	Compatibility for old ffs superblock layouts has been
24	added, and the restrictive fsck checks have been reenabled
25	when using those layouts.  If you have been using -current
26	since 20030402, you may find that fsck again signals fatal
27	superblock mismatches.  To work around, make sure you have
28        an updated fsck_ffs and then you can use fsck_ffs -b 16 -c 4
29	to complete the filesystem upgrade.  A message has
30 	been added to the kernel which should detect this problem.
31        See the following discussion for more information:
32        http://mail-index.netbsd.org/current-users/2004/01/11/0022.html
33
3420031203:
35	New binutils builds may fail due to old dependencies.
36	It's necessary to "make cleandir" to ensure that
37	the dependencies will be rebuilt correctly.
38
3920031111:
40	A newer mkdep is needed.  Error noting that is
41		cc: Ambiguous abbreviation --
42
4320031008:
44	/usr/include/sys/disklabel_mbr.h was removed.
45	It's necessary to "make cleandir" to ensure that
46	the dependencies will be rebuilt correctly.
47
4820031007:
49        A sign exension bug was fixed which set all the high bits
50        of our newly expanded ffs fs_flags.  This should only
51        affect users who installed or upgraded in September of 2003.
52	A small utility program was posted to tech-kern which
53        should fix this problem, and a warning message was added
54        to the kernel which should discover and warn about it.  See
55        http://mail-index.NetBSD.org/tech-kern/2003/10/07/0005.html
56
5720030906:
58	With the addition of siginfo support the old signal trampoline
59	code has been deprecated to COMPAT_16. Make sure that your running
60	kernel has COMPAT_16 enabled before building userland.
61
6220030801:
63	With the new openssl, there is some header and library shuffling.
64	rm -f /usr/include/des.h /usr/include/kerberosIV/* /lib/libdes* \
65	/usr/lib/libdes* before building.
66
6720030703:
68	Texinfo was updated to 4.6.  To avoid failures when trying to
69	build the included texinfo files, do:
70
71	cd src/gnu/usr.bin/texinfo
72	make MKINFO=no dependall install
73
7420030630:
75	Groff was updated to 1.19; it's probably necessary to do
76		cd share/mk && make install
77		cd src/gnu/usr.bin/groff
78		make MKMAN=no dependall install
79	(untested).
80
8120030516:
82	Due to bugs in the export handling code, invalid export lines
83	were accepted before and caused the kernel to panic when
84	mountd got restarted because it freed memory that had already
85	been freed. This has been fixed and the kernel checks
86	export addresses very strictly. If you upgrade your kernel,
87	make sure you also upgrade mountd, because if your export
88	file contains lines with an old inet4 address syntax (i.e.
89	a.b.c or a.b or a), they will get rejected by the new kernel.
90
9120030402:
92	The superblock layout for FFS was changed.  If you have 1.6
93	fsck binaries, they will signal a fatal superblock mismatch
94	with the first alternate, because they compare too many
95	fields (even ones that aren't useful).  If possible, upgrade
96	your fsck_ffs binary before using a new kernel.
97	None of this signals actual filesystem damage.
98
9920030324:
100	sendmail version 8.12.8 was imported.  Since sendmail is
101	now setgid to the smmsp group, and runs in "collection"
102	mode for most common activities, there is a new config
103	file called submit.cf that needs to live in /etc/mail.
104	The generic submit.cf sample in /usr/share/sendmail/cf
105	is named netbsd-msp.cf.  Upgrading your regular sendmail
106	configuration file is also strongly advised.
107
108	See the section named "MESSAGE SUBMISSION PROGRAM" in
109	the updated /usr/share/sendmail/README file for more
110	information.
111
11220030117:
113	Texinfo was updated to 4.3.  To avoid failures when trying to
114	build the included texinfo files, do:
115
116	cd src/gnu/usr.bin/texinfo
117	make MKINFO=no dependall install
118
11920021223:
120	The METALOG format changed slightly, to remove the leading
121	"${DESTDIR}" from path names.
122	This only affects people building with UNPRIVED.
123	For complete safety, remove the DESTDIR entirely and
124	update tools/mtree, before running make build.
125
12620021219:
127	CVS repository layout was changed.  See the following for details
128	if you are using (anonymous) cvs to update your tree.
129
130	http://mail-index.NetBSD.org/netbsd-announce/2002/12/19/0000.html
131
13220021219:
133	install(1) had a '-N dbdir' option added, to specify an
134	alternate location to look up users & groups (instead
135	of the host system passwd(5) and group(5) databases).
136
137	The build system was modified to take advantage of
138	this option (using ${NETBSDSRCDIR}/etc), so if you
139	use USETOOLS==no, you may have to rebuild and
140	reinstall usr.bin/xinstall first.
141
14220021130:
143	fparseln(3) moved from libutil to libc.
144	If building to DESTDIR=/, reinstall the includes
145	and rebuild libc:
146		make includes
147		make do-lib-libc
148	If using build.sh, "cd tools/compat && make clean"
149	before rebuilding the tools.
150
15120021126:
152	The mk.conf(5) variable SYS_INCLUDE has been deprecated,
153	including the optional "SYS_INCLUDE=symlinks" support.
154	All header files, including <sys/*.h> are copied into
155	/usr/include.
156
15720021121:
158	The C run-time support files crtbegin.o and crtend.o
159	(and their companions crtbeginS.o and crtendS.o) were
160	split up, with new crti.o and crtn.o files resulting.
161	This means that libtool needs to be rebuilt once the
162	new libraries are installed.  The process of rebuilding
163	libtool will cause it to automatically notice the new
164	required files, but it *must* be rebuilt in order to
165	do this.
166
167	An out-of-date libtool will result in shared libraries
168	which lack _init() and _fini() routines, which means that
169	their global contructors/destructors will not be invoked.
170
17120021121:
172	A bug related to how ARM ELF objects were tagged has been
173	corrected.
174
175	NetBSD ARM ELF uses the soft-VFP floating point model by
176	default.  However, the assembler lacked support for marking
177	objects as using the VFP floating point format, and the
178	compiler was not properly passing the flag indicating "soft-VFP"
179	to the assembler.
180
181	Unfortunately, this means that the linker will now consider
182	old (i.e. not marked "softvfp") NetBSD ARM ELF objects to be
183	incompatible with new (properly marked) objects.
184
185	The problem will only manifest itself if you attempt to compile
186	a new program using the fixed toolchain, and link that program
187	against old libraries which do not have the proper "softvfp"
188	markings.  ALL OF YOUR EXISTING BINARIES AND SHARED LIBRARIES
189	WILL CONTINUE TO WORK PROPERLY.
190
191	The only work-around for the problem is to recompile all of
192	the libraries on the system.  The easiest way to do this for
193	system libraries is to install a binary snapshot; they are
194	generally available on releng.NetBSD.org.  Any packages you
195	have installed which supply libraries will have to be recompiled
196	if you wish to link new programs against those libraries.
197
198	If you have questions about this matter, please contact
199	port-arm@NetBSD.org.
200
20120021011:
202	Systrace has been improved to support privilege elevation.
203	Updating the kernel requires the userland part of systrace
204	to be rebuilt.
205
20620021010:
207	The config(8) grammar was changed to allow options to register
208	dependencies on attributes, as well as other options.  Users
209	must update and reinstall usr.sbin/config before building a new
210	kernel.
211
21220021009:
213	A new attribute dependency syntax was introduced to config(8),
214	which is now used by the SCSI configuration description.  Users
215	must update and reinstall usr.sbin/config before building a new
216	kernel.
217
21820021003:
219	Several changes have been made to the autoconfiguration
220	framework.  Users must update and reinstall usr.sbin/config
221	before building a new kernel.
222
22320021001:
224	The i386mp branch has been merged.  To compile a kernel, users
225	will need to add the option 'cpu* at mainbus?' to their configuration
226	file.  Multiprocessor kernels will need
227	ioapic*		at mainbus? apid ?
228	options		MULTIPROCESSOR
229	options		COM_MPLOCK
230
23120020922:
232	MKDYNAMICROOT=yes enabled by default, which means that
233	certain shared libraries are installed into /lib, the shared
234	linker is installed into /libexec, and all programs in /bin
235	and /sbin are dynamically linked.
236	If you do not use "make build", you should ensure that
237	you have the libraries and shared linker in the new locations,
238	with:
239		make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so
240
24120020917:
242	USE_NEW_TOOLCHAIN has been replaced with:
243	    -	TOOLCHAIN_MISSING -- set to "yes" on platforms for which
244		there is no working in-tree toolchain (hppa, ns32k, sh5,
245		x86_64).
246	    -	EXTERNAL_TOOLCHAIN -- if defined by the user, points to the
247		root of an external toolchain (e.g. /usr/local/gnu).  This
248		enables the cross-build framework even for TOOLCHAIN_MISSING
249		platforms.
250
25120020906:
252	gehenna-devsw has been merged into the trunk. Need to update and
253	reinstall usr.sbin/config before building the kernel.
254
25520020822:
256	Crunched rescue tools (contents of /bin and /sbin, plus others)
257	are now provided in /rescue.
258
259	To ensure that these are built statically linked (no matter
260	what the setting of LDSTATIC is), use a crunchgen(1) built
261	from sources newer than 20020820 (see the next entry).
262
26320020820:
264	crunchgen(1) changed to ensure that the generated program
265	is statically linked.
266
267	Solution: update and reinstall usr.bin/crunch
268
26920020605:
270	smmsp user/group has been added for sendmail.
271
272	Add the following into /etc/group:
273
274	smmsp:*:17:
275
276	and the following to /etc/master.passwd (via vipw):
277
278	smmsp:*:17:17::0:0:Sendmail Message Submission Program:/nonexistent:/sbin/nologin
279
28020020515:
281	sshd user/group has been added.  Need to hand add this in, or sshd
282	will not let you log in (with default, or UsePrivlegeSeparation=yes)
283
284	Add the following into /etc/group:
285
286	sshd:*:16:
287
288	and the following to /etc/master.passwd (via vipw):
289
290	sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
291	
292	Also /var/chroot/sshd directory needs to be present (digged as part of
293	the build process).
294
29520020426:
296	NBUILDJOBS obsoleted in favor of just using -j.
297
29820020426:
299	etc/postinstall added, which performs various checks for 
300	configuration file updates and changes, and can fix most of
301	the problems identified.
302	This should make it much easier to upgrade a system's
303	configuration from earlier systems (as far back as NetBSD 1.5).
304
30520020320:
306	<bsd.lib.mk> needs a new install(1) for its "-a cmd" support.
307	Build and install at usr.bin/xinstall before the build.
308
30920020319:
310	Raw IPv6 socket now makes strict checking for sa_family and sa_len
311	on send(2) operation.  Be sure to have sbin/rtsol and usr.sbin/rtsold
312	newer than November 2001 when you upgrade the kernel.
313
31420020311:
315	ssh configuration files were moved from /etc to /etc/ssh.  Beware
316	if you restart your machine from remote.  Note that sshd.conf needs
317	to be changed (due to the use of "/etc" inside).
318
31920020223:
320	Users of the VAX port will need to rebuild and install gas
321	so it deal with the now present register prefix used in all
322	the VAX assembly files.
323
32420020118:
325	ntpd user/group has been added.  Need to hand add this in or builds
326	will break as mtree aborts early.
327
328	Add the following into /etc/group:
329
330	ntpd:*:15:
331
332	and the following to /etc/master.passwd (via vipw):
333
334	ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
335
33620011207:
337	If you're attempting to build a snapshot on sparc64 and are getting
338	reloc errors from the toolchain groff binary this means your native
339	toolchain has some broken C++ bits.
340
341	To fix:
342
343	Build a new toolchain (i.e. build.sh -t)
344	Use the new toolchain to build and install natively (i.e. /usr/lib)
345
346	gnu/lib/libgcc
347	gnu/lib/libstdc++
348
349	After this a snapshot will be able to be built.
350
35120011201:
352	In order for a sparc64 build to work you must have a working awk. If
353	you've built and installed a system with the new toolchain up to this
354	point you do not have a working awk as its ability to do floating
355	point is broken. 
356
357	To build:
358
359	remake and install gnu/lib/libgcc
360	remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
361	against the new libgcc.a)
362
36320011128:
364	Kernel config information was changed to use defflag in
365	the various "files" files.  Bug fixes to config(8) are
366	required in order for this to work properly.  Make sure
367	to build and install in usr.sbin/config before attempting
368	to build a new kernel.
369
37020011030:
371	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
372	before building libc.
373
37420011029:
375	The new document BUILDING.mdoc (view with nroff | more, or
376	see pre-generated .txt and .html versions) describes the build
377	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
378	build process, are intended in the long run to replace this
379	manual update log.
380
381	Users building a USE_NEW_TOOLCHAIN system should read the
382	BUILDING document for caveats.  Generally, BUILDING supersedes
383	UPDATING for these systems, as tool updating is taken care of
384	by the new build system.
385
38620011028:
387	src/etc/Makefile now needs install to be able to handle
388	symlinks that point to nowhere. A bug in install that
389	prevented this was corrected.
390
391	Solution: update and reinstall usr.bin/xinstall
392	Better Solution: Use the new toolchain and it will just work
393	for you.
394
39520011006:
396	/etc/mtree/NetBSD.dist has been updated to take advantage of
397	absolute path support added to mtree(8). Older mtree(8)s don't
398	understand the format.
399
400	Solution: update and reinstall usr.sbin/mtree
401
40220011004:
403	Crunchgen has been updated to work via reach-over makefiles. Updating
404	is suggested before running a snapshot build
405
40620010915:
407	The new "ubcperf" code committed by Chuck Silvers removed
408	a header file, uvm/uvm_vnode.h.  There may be stale .depend
409	files that still reference this file.
410
411	Solution: "make cleandir && make dependall" in affected
412	directories.
413
41420010803:
415	grep.info is now built from grep.texi using makeinfo.  Since it
416	requires makeinfo v4.0, you need to install new texinfo before
417	building gnu/usr.bin/grep.  To install new texinfo, please follow
418	the instruction described in 20010726 entry.
419
42020010803: 
421	(i386 only): i386 kernel now uses new instructions like
422        `fxsave' which old gas doesn't understand.  To build the
423	kernel successfully, you need to build and install a new toolchain, 
424	(i.e., build.sh -t) or 	(temporarily) comment out "options I686_CPU" 
425	from your kernel configuration until you rebuild your userland.
426	See 20011029 above and BUILDING file in this directory for more information.
427	[updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
428
42920010731:
430	Bootloader update on ELF platforms.  DDB in kernels from before
431	this will be unable to read symbol tables provided by newer
432	bootloaders.
433
43420010726:
435	Texinfo was updated to 4.0.  To avoid failures when trying to
436	build the included texinfo files, do:
437
438	cd src/gnu/usr.bin/texinfo
439	make MKINFO=no dependall install
440
44120010718:
442	Enabled correct .init/.fini processing in crt0.  The way this
443	was done was to change a -I directive to cc(1), which means
444	make(1) will have a stale dependency (it will be checking the
445	timestamp on the wrong "dot_init.h").
446
447	The symptom you will see is that new programs die with SIGSEGV
448	if you have a stale dependency.
449
450	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
451	before starting your build.
452
45320010628:
454	A construct was added to uvm_page.h that uncovered a bug
455	in lint(1).  If you get a warning/error about a non-portable
456	bitfield, update your lint(1) before proceeding.
457
45820010226:
459	Added named user/group to system. Need to hand add this in or builds
460	will break as mtree aborts early.
461
462	To work around add by hand:
463
464	named:*:14:
465
466	to /etc/group and add:
467
468	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
469
470	to master.passwd (use vipw for instance if doing by hand).
471
472	Now a make build should progress.
473
47420010219:
475	get/setprogname() added. Any hostprogs that may use this will need
476        to be bootstrapped manually until the host system is current.
477
478        Known problems: sys/arch/macppc/stand/fixcoff
479			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
480			  CFLAGS and rebuilding should work)
481			usr.sbin/mdsetimage - Build a static copy if
482  		          building a snapshot before fully bootstrapped.
483
48420010204:
485	prepare the code to compile with stricter gcc flags. in
486	particular start eliminating redundant declarations. Yacc
487	needs to be installed before make build.
488
48920010114:
490	introduce .if commands(target) in make(1). You need to
491	bring everything up-to-date first, then without installing
492	anything make and install in usr.bin/make, then proceed
493	with make build.
494
49520010101:
496	bsd.subdir.mk committed 20001230 had a bug which caused
497	afterinstall targets to run too soon; update again.
498
49920001230:
500	New share/mk files needed to support .WAIT in SUBDIR variables.
501	If you get make errors, 
502		(cd share/mk; make install)
503	Also, PRINTOBJDIR has changed and is now used more heavily.
504
50520001019:
506	The `ca' device driver has been replaced by `ld'; although the
507	major and minor numbers haven't changed, you should update your /dev
508	directory.
509
51020000929:
511	The following make directives are obsoleted.
512	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
513	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
514	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
515	additional library libcrypto_{idea,rc5}.
516
517
518Hints for a more successful build:
519^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
520    Build a new kernel first:
521	This makes sure that any new system calls or features
522	   expected by the new userland will be present.  This
523	   helps to avoid critical errors when upgrading.
524    Use object directories:
525	This helps to keep stale object
526	   files from polluting the build if a Makefile "forgets"
527	   about one.  It also makes it easier to clean up after
528	   a build.  It's also necessary if you want to use the
529	   same source tree for multiple machines.
530	   To use object directories:
531	    a) cd /usr/src ; make cleandir
532	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
533	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
534	    d) cd /usr/src ; make build
535	   Note that running "make obj" in a directory will create
536	   in obj.$MACHINE directory.
537    Build to a DESTDIR:
538	This helps to keep old
539	   installed files (especially libraries) from interfering
540	   with the new build.
541	   To build to a DESTDIR, set the DESTDIR environment
542	   variable before running make build.  It should be set to
543	   the pathname of an initially empty directory.
544	   Problems: you might need to update critical utilities
545		without using DESTDIR since nothing is executed
546		from what is installed in DESTDIR.
547		(See critical utils, below)
548    Build often:
549	This keeps critical utilities current enough to not choke
550	on any other part of the source tree that depends on up to
551	date functionality.
552 
553What to do if things don't work:
554^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
555When things don't work there is usually a few things that commonly
556should be done.
557    1)	make includes
558	This should be done automatically by make build.
559    2)  cd share/mk && make install
560	Again, automatically done by make build.
561
562Failsafe rebuild of a small part of the tree:
563^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
564To make sure you rebuild something correctly you want to do
565something like the following:
566    1)  Make sure the includes and .mk files are up to date.
567    2)  Make sure any program used to build the particular
568	utility is up to date.  (yacc, lex, etc...)
569    3)  cd ...path/to/util...
570	make cleandir
571	rm ...all obj directories...
572	make cleandir			# yes, again
573	make obj
574	make depend && make
575
576Failsafe rebuild of the entire tree:
577^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
578If you really want to make sure the source tree is clean and
579ready for a build try the following.  Note that sourcing /etc/mk.conf
580(a make(1) Makefile) in this manner is not right, and will not work
581for anyone who uses any make(1) features in /etc/mk.conf.
582
583---cut here---
584#!/bin/sh
585. /etc/mk.conf
586
587if [ -z $NETBSDSRCDIR ] ; then
588    NETBSDSRCDIR=/usr/src
589fi
590if [ \! -d $NETBSDSRCDIR ] ; then
591    echo Unable to find sources
592    exit 1
593fi
594find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
595
596if [ -z $BSDOBJDIR ] ; then
597    BSDOBJDIR=/usr/obj
598fi
599if [ -d $BSDOBJDIR ] ; then
600    rm -rf $BSDOBJDIR
601fi
602
603cd $NETBSDSRCDIR && make cleandir
604
605---cut here---
606
607Critical utilities:
608^^^^^^^^^^^^^^^^^^^
609	gnu/usr.bin/egcs
610	usr.bin/compile_et
611	usr.bin/make
612	usr.bin/yacc
613	usr.bin/lex
614	usr.bin/xlint
615	usr.sbin/config
616
617Other problems and possible solutions:
618^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
619Symptom:Unreasonable compiler errors.
620Fix:	Rebuild gnu/usr.bin/egcs
621
622Symptom:Complaints involving a Makefile.
623Fix:	Rebuild usr.bin/make:
624	cd usr.bin/make && make && make install
625        Or, a failsafe method if that doesn't work:
626	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
627
628Fix:	Make sure .mk files are up to date.
629	cd share/mk && make install
630
631Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
632Fix:	Rebuild usr.sbin/config
633
634Symptom:
635Fix:	Rebuild usr.bin/yacc
636
637Symptom:
638Fix:	Rebuild usr.bin/lex
639
640Symptom:
641Fix:	rm /usr/lib/libbfd.a
642
643Symptom:Obsolete intermediate files are used during compilation
644Fix:	Try the following sequence of commands in the directory in question.
645	make cleandir; rm `make print-objdir`; make cleandir; make obj
646	(If you built the tree without "make obj" in the past, obsolete files
647	may remain.  The command tries to clean everything up)
648
649Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
650Fix:	Rebuild and install usr.bin/menuc
651
652Symptom:mklocale not found during build in share/locale/ctype
653Fix:	Build and install usr.bin/mklocale
654
655Symptom:undefined reference to `__assert13' or `__unsetenv13'
656Fix:    Rebuild and install lib/libc
657
658Symptom:usr.sbin/config fails to build.
659Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
660
661Symptom:undefined reference to `getprogname' or `setprogname'
662Fix:    Rebuild and install lib/libc
663
664Symptom:lint does not understand the '-X' option
665Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
666