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