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