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