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