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