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