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