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