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