UPDATING revision 1.60
1$NetBSD: UPDATING,v 1.60 2002/05/02 22:13:30 sommerfeld 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
1120020426:
12	NBUILDJOBS obsoleted in favor of just using -j.
13
1420020426:
15	etc/postinstall added, which performs various checks for 
16	configuration file updates and changes, and can fix most of
17	the problems identified.
18	This should make it much easier to upgrade a system's
19	configuration from earlier systems (as far back as NetBSD 1.5).
20
2120020320:
22	<bsd.lib.mk> needs a new install(1) for it's "-a cmd" support.
23	build and install at usr.bin/xinstall before the build.
24
2520020319:
26	raw IPv6 socket now makes strict checking for sa_family and sa_len
27	on send(2) operation.  be sure to have sbin/rtsol and usr.sbin/rtsold
28	newer than November 2001 when you upgrade the kernel.
29
3020020311:
31	ssh configuration files were moved from /etc to /etc/ssh.  Beware
32	if you restart your machine from remote.  Note that sshd.conf needs
33	to be changed (due to the use of "/etc" inside).
34
3520020223:
36	Users of the VAX port will need to rebuild and install gas
37	so it deal with the now present register prefix used in all
38	the VAX assembly files.
39
4020020118:
41
42	ntpd user/group has been added.  Need to hand add this in or builds
43	will break as mtree aborts early.
44
45	Add the following into /etc/group:
46
47	ntpd:*:15:
48
49	and the following to /etc/master.passwd (via vipw):
50
51	ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
52
5320011207:
54
55	If you're attempting to build a snapshot on sparc64 and are getting
56	reloc errors from the toolchain groff binary this means your native
57	toolchain has some broken C++ bits.
58
59	To fix:
60
61	Build a new toolchain (i.e. build.sh -t)
62	Use the new toolchain to build and install natively (i.e. /usr/lib)
63
64	gnu/lib/libgcc
65	gnu/lib/libstdc++
66
67	After this a snapshot will be able to be built.
68
6920011201:
70	In order for a sparc64 build to work you must have a working awk. If
71	you've built and installed a system with the new toolchain up to this
72	point you do not have a working awk as its ability to do floating
73	point is broken. 
74
75	To build:
76
77	remake and install gnu/lib/libgcc
78	remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
79	against the new libgcc.a)
80
8120011128:
82	Kernel config information was changed to use defflag in
83	the various "files" files.  Bug fixes to config(8) are
84	required in order for this to work properly.  Make sure
85	to build and install in usr.sbin/config before attempting
86	to build a new kernel.
87
8820011030:
89	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
90	before building libc.
91
9220011029:
93	The new document BUILDING.mdoc (view with nroff | more, or
94	see pre-generated .txt and .html versions) describes the build
95	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
96	build process, are intended in the long run to replace this
97	manual update log.
98
99	Users building a USE_NEW_TOOLCHAIN system should read the
100	BUILDING document for caveats.  Generally, BUILDING supersedes
101	UPDATING for these systems, as tool updating is taken care of
102	by the new build system.
103
10420011028:
105	src/etc/Makefile now needs install to be able to handle
106	symlinks that point to nowhere. A bug in install that
107	prevented this was corrected.
108
109	Solution: update and reinstall usr.bin/xinstall
110	Better Solution: Use the new toolchain and it will just work
111	for you.
112
11320011006:
114	/etc/mtree/NetBSD.dist has been updated to take advantage of
115	absolute path support added to mtree(8). Older mtree(8)s don't
116	understand the format.
117
118	Solution: update and reinstall usr.sbin/mtree
119
12020011004:
121	Crunchgen has been updated to work via reach-over makefiles. Updating
122	is suggested before running a snapshot build
123
12420010915:
125	The new "ubcperf" code committed by Chuck Silvers removed
126	a header file, uvm/uvm_vnode.h.  There may be stale .depend
127	files that still reference this file.
128
129	Solution: "make cleandir && make dependall" in affected
130	directories.
131
13220010803:
133	grep.info is now built from grep.texi using makeinfo.  Since it
134	requires makeinfo v4.0, you need to install new texinfo before
135	building gnu/usr.bin/grep.  To install new texinfo, please follow
136	the instruction described in 20010726 entry.
137
13820010803:
139	(i386 only): i386 kernel now uses new instructions like
140        `fxsave' which old gas doesn't understand.  To build the
141	kernel successfully, you need to build and install new gas
142	(gnu/usr.bin/gas.new), or (temporarily) comment out
143	"options I686_CPU" from your kernel configuration until you
144	rebuilt your userland (and got a new gas).
145
14620010731:
147	Bootloader update on ELF platforms.  DDB in kernels from before
148	this will be unable to read symbol tables provided by newer
149	bootloaders.
150
15120010726:
152	Texinfo was updated to 4.0.  To avoid failures when trying to
153	build the included texinfo files, do:
154
155	cd src/gnu/usr.bin/texinfo
156	make MKINFO=no dependall install
157
15820010718:
159	Enabled correct .init/.fini processing in crt0.  The way this
160	was done was to change a -I directive to cc(1), which means
161	make(1) will have a stale dependency (it will be checking the
162	timestamp on the wrong "dot_init.h").
163
164	The symptom you will see is that new programs die with SIGSEGV
165	if you have a stale dependency.
166
167	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
168	before starting your build.
169
17020010628:
171	A construct was added to uvm_page.h that uncovered a bug
172	in lint(1).  If you get a warning/error about a non-portable
173	bitfield, update your lint(1) before proceeding.
174
17520010226:
176	Added named user/group to system. Need to hand add this in or builds
177	will break as mtree aborts early.
178
179	To work around add by hand:
180
181	named:*:14:
182
183	to /etc/group and add:
184
185	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
186
187	to master.passwd (use vipw for instance if doing by hand).
188
189	Now a make build should progress.
190
19120010219:
192	get/setprogname() added. Any hostprogs that may use this will need
193        to be bootstrapped manually until the host system is current.
194
195        Known problems: sys/arch/macppc/stand/fixcoff
196			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
197			  CFLAGS and rebuilding should work)
198			usr.sbin/mdsetimage - Build a static copy if
199  		          building a snapshot before fully bootstrapped.
200
20120010204:
202	prepare the code to compile with stricter gcc flags. in
203	particular start eliminating redundant declarations. Yacc
204	needs to be installed before make build.
205
20620010114:
207	introduce .if commands(target) in make(1). You need to
208	bring everything up-to-date first, then without installing
209	anything make and install in usr.bin/make, then proceed
210	with make build.
211
21220010101:
213	bsd.subdir.mk committed 20001230 had a bug which caused
214	afterinstall targets to run too soon; update again.
215
21620001230:
217	New share/mk files needed to support .WAIT in SUBDIR variables.
218	If you get make errors, 
219		(cd share/mk; make install)
220	Also, PRINTOBJDIR has changed and is now used more heavily.
221
22220001019:
223	The `ca' device driver has been replaced by `ld'; although the
224	major and minor numbers haven't changed, you should update your /dev
225	directory.
226
22720000929:
228	The following make directives are obsoleted.
229	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
230	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
231	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
232	additional library libcrypto_{idea,rc5}.
233
234
235Hints for a more successful build:
236^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
237    Build a new kernel first:
238	This makes sure that any new system calls or features
239	   expected by the new userland will be present.  This
240	   helps to avoid critical errors when upgrading.
241    Use object directories:
242	This helps to keep stale object
243	   files from polluting the build if a Makefile "forgets"
244	   about one.  It also makes it easier to clean up after
245	   a build.  It's also necessary if you want to use the
246	   same source tree for multiple machines.
247	   To use object directories:
248	    a) cd /usr/src ; make cleandir
249	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
250	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
251	    d) cd /usr/src ; make build
252	   Note that running "make obj" in a directory will create
253	   in obj.$MACHINE directory.
254    Build to a DESTDIR:
255	This helps to keep old
256	   installed files (especially libraries) from interfering
257	   with the new build.
258	   To build to a DESTDIR, set the DESTDIR environment
259	   variable before running make build.  It should be set to
260	   the pathname of an initially empty directory.
261	   Problems: you might need to update critical utilities
262		without using DESTDIR since nothing is executed
263		from what is installed in DESTDIR.
264		(See critical utils, below)
265    Build often:
266	This keeps critical utilities current enough to not choke
267	on any other part of the source tree that depends on up to
268	date functionality.
269 
270What to do if things don't work:
271^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
272When things don't work there is usually a few things that commonly
273should be done.
274    1)	make includes
275	This should be done automatically by make build.
276    2)  cd share/mk && make install
277	Again, automatically done by make build.
278
279Failsafe rebuild of a small part of the tree:
280^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
281To make sure you rebuild something correctly you want to do
282something like the following:
283    1)  Make sure the includes and .mk files are up to date.
284    2)  Make sure any program used to build the particular
285	utility is up to date.  (yacc, lex, etc...)
286    3)  cd ...path/to/util...
287	make cleandir
288	rm ...all obj directories...
289	make cleandir			# yes, again
290	make obj
291	make depend && make
292
293Failsafe rebuild of the entire tree:
294^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
295If you really want to make sure the source tree is clean and
296ready for a build try the following.  Note that sourcing /etc/mk.conf
297(a make(1) Makefile) in this manner is not right, and will not work
298for anyone who uses any make(1) features in /etc/mk.conf.
299
300---cut here---
301#!/bin/sh
302. /etc/mk.conf
303
304if [ -z $NETBSDSRCDIR ] ; then
305    NETBSDSRCDIR=/usr/src
306fi
307if [ \! -d $NETBSDSRCDIR ] ; then
308    echo Unable to find sources
309    exit 1
310fi
311find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
312
313if [ -z $BSDOBJDIR ] ; then
314    BSDOBJDIR=/usr/obj
315fi
316if [ -d $BSDOBJDIR ] ; then
317    rm -rf $BSDOBJDIR
318fi
319
320cd $NETBSDSRCDIR && make cleandir
321
322---cut here---
323
324Critical utilities:
325^^^^^^^^^^^^^^^^^^^
326	gnu/usr.bin/egcs
327	usr.bin/compile_et
328	usr.bin/make
329	usr.bin/yacc
330	usr.bin/lex
331	usr.bin/xlint
332	usr.sbin/config
333
334Other problems and possible solutions:
335^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336Symptom:Unreasonable compiler errors.
337Fix:	Rebuild gnu/usr.bin/egcs
338
339Symptom:Complaints involving a Makefile.
340Fix:	Rebuild usr.bin/make:
341	cd usr.bin/make && make && make install
342        Or, a failsafe method if that doesn't work:
343	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
344
345Fix:	Make sure .mk files are up to date.
346	cd share/mk && make install
347
348Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
349Fix:	Rebuild usr.sbin/config
350
351Symptom:
352Fix:	Rebuild usr.bin/yacc
353
354Symptom:
355Fix:	Rebuild usr.bin/lex
356
357Symptom:
358Fix:	rm /usr/lib/libbfd.a
359
360Symptom:Obsolete intermediate files are used during compilation
361Fix:	Try the following sequence of commands in the directory in question.
362	make cleandir; rm `make print-objdir`; make cleandir; make obj
363	(If you built the tree without "make obj" in the past, obsolete files
364	may remain.  The command tries to clean everything up)
365
366Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
367Fix:	Rebuild and install usr.bin/menuc
368
369Symptom:mklocale not found during build in share/locale/ctype
370Fix:	Build and install usr.bin/mklocale
371
372Symptom:undefined reference to `__assert13'
373Fix:    Rebuild and install lib/libc
374
375Symptom:usr.sbin/config fails to build.
376Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
377
378Symptom:undefined reference to `getprogname' or `setprogname'
379Fix:    Rebuild and install lib/libc
380
381Symptom:lint does not understand the '-X' option
382Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
383