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