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