UPDATING revision 1.44
1$NetBSD: UPDATING,v 1.44 2001/10/29 19:57:38 tv 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
1120011029:
12	The new document BUILDING.mdoc (view with nroff | more, or
13	see pre-generated .txt and .html versions) describes the build
14	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
15	build process, are intended in the long run to replace this
16	manual update log.
17
18	Users building a USE_NEW_TOOLCHAIN system should read the
19	BUILDING document for caveats.  Generally, BUILDING supersedes
20	UPDATING for these systems, as tool updating is taken care of
21	by the new build system.
22
2320011028:
24	src/etc/Makefile now needs install to be able to handle
25	symlinks that point to nowhere. A bug in install that
26	prevented this was corrected.
27
28	Solution: update and reinstall usr.bin/xinstall
29	Better Solution: Use the new toolchain and it will just work
30	for you.
31
3220011006:
33	/etc/mtree/NetBSD.dist has been updated to take advantage of
34	absolute path support added to mtree(8). Older mtree(8)s don't
35	understand the format.
36
37	Solution: update and reinstall usr.sbin/mtree
38
3920011004:
40	Crunchgen has been updated to work via reach-over makefiles. Updating
41	is suggested before running a snapshot build
42
4320010915:
44	The new "ubcperf" code committed by Chuck Silvers removed
45	a header file, uvm/uvm_vnode.h.  There may be stale .depend
46	files that still reference this file.
47
48	Solution: "make cleandir && make dependall" in affected
49	directories.
50
5120010803:
52	grep.info is now built from grep.texi using makeinfo.  Since it
53	requires makeinfo v4.0, you need to install new texinfo before
54	building gnu/usr.bin/grep.  To install new texinfo, please follow
55	the instruction described in 20010726 entry.
56
5720010803:
58	(i386 only): i386 kernel now uses new instructions like
59        `fxsave' which old gas doesn't understand.  To build the
60	kernel successfuly, you need to build and install new gas
61	(gnu/usr.bin/gas.new), or (temporarily) comment out
62	"options I686_CPU" from your kernel configuration until you
63	rebuilt your userland (and got a new gas).
64
6520010731:
66	Bootloader update on ELF platforms.  DDB in kernels from before
67	this will be unable to read symbol tables provided by newer
68	bootloaders.
69
7020010726:
71	Texinfo was updated to 4.0.  To avoid failures when trying to
72	build the included texinfo files, do:
73
74	cd src/gnu/usr.bin/texinfo
75	make MKINFO=no dependall install
76
7720010718:
78	Enabled correct .init/.fini processing in crt0.  The way this
79	was done was to change a -I directive to cc(1), which means
80	make(1) will have a stale dependency (it will be checking the
81	timestamp on the wrong "dot_init.h").
82
83	The symptom you will see is that new programs die with SIGSEGV
84	if you have a stale dependency.
85
86	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
87	before starting your build.
88
8920010628:
90	A construct was added to uvm_page.h that uncovered a bug
91	in lint(1).  If you get a warning/error about a non-portable
92	bitfield, update your lint(1) before proceeding.
93
9420010226:
95	Added named user/group to system. Need to hand add this in or builds
96	will break as mtree aborts early.
97
98	To work around add by hand:
99
100	named:*:14:
101
102	to /etc/group and add:
103
104	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
105
106	to master.passwd (use vipw for instance if doing by hand).
107
108	Now a make build should progress.
109
11020010219:
111	get/setprogname() added. Any hostprog's that may use this will need
112        to be bootstrapped manually until the host system is current.
113
114        Known problems: sys/arch/macppc/stand/fixcoff
115			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
116			  CFLAGS and rebuilding should work)
117			usr.sbin/mdsetimage - Build a static copy if
118  		          building a snapshot before fully bootstrapped.
119
12020010204:
121	prepare the code to compile with stricter gcc flags. in
122	particular start eliminating redundant declarations. Yacc
123	needs to be installed before make build.
124
12520010114:
126	introduce .if commands(target) in make(1). You need to
127	bring everything up-to-date first, then without installing
128	anything make and install in usr.bin/make, then proceed
129	with make build.
130
13120010101:
132	bsd.subdir.mk committed 20001230 had a bug which caused
133	afterinstall targets to run too soon; update again.
134
13520001230:
136	New share/mk files needed to support .WAIT in SUBDIR variables.
137	If you get make errors, 
138		(cd share/mk; make install)
139	Also, PRINTOBJDIR has changed and is now used more heavily.
140
14120001019:
142	The `ca' device driver has been replaced by `ld'; although the
143	major and minor numbers haven't changed, you should update your /dev
144	directory.
145
14620000929:
147	The following make directives are obsoleted.
148	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
149	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
150	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
151	additional library libcrypto_{idea,rc5}.
152
153
154Hints for a more successful build:
155^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156    Build a new kernel first:
157	This makes sure that any new system calls or features
158	   expected by the new userland will be present.  This
159	   helps to avoid critical errors when upgrading.
160    Use object directories:
161	This helps to keep stale object
162	   files from polluting the build if a Makefile "forgets"
163	   about one.  It also makes it easier to clean up after
164	   a build.  It's also necessary if you want to use the
165	   same source tree for multiple machines.
166	   To use object directories:
167	    a) cd /usr/src ; make cleandir
168	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
169	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
170	    d) cd /usr/src ; make build
171	   Note that running "make obj" in a directory will create
172	   in obj.$MACHINE directory.
173    Build to a DESTDIR:
174	This helps to keep old
175	   installed files (especially libraries) from interfering
176	   with the new build.
177	   To build to a DESTDIR, set the DESTDIR environment
178	   variable before running make build.  It should be set to
179	   the pathname of an initially empty directory.
180	   Problems: you might need to update critical utilities
181		without using DESTDIR since nothing is executed
182		from what is installed in DESTDIR.
183		(See critical utils, below)
184    Build often:
185	This keeps critical utilities current enough to not choke
186	on any other part of the source tree that depends on up to
187	date functionality.
188 
189What to do if things don't work:
190^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191When things don't work there is usually a few things that commonly
192should be done.
193    1)	make includes
194	This should be done automatically by make build.
195    2)  cd share/mk && make install
196	Again, automatically done by make build.
197
198Failsafe rebuild of a small part of the tree:
199^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200To make sure you rebuild something correctly you want to do
201something like the following:
202    1)  Make sure the includes and .mk files are up to date.
203    2)  Make sure any program used to build the particular
204	utility is up to date.  (yacc, lex, etc...)
205    3)  cd ...path/to/util...
206	make cleandir
207	rm ...all obj directories...
208	make cleandir			# yes, again
209	make obj
210	make depend && make
211
212Failsafe rebuild of the entire tree:
213^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
214If you really want to make sure the source tree is clean and
215ready for a build try the following.  Note that sourcing /etc/mk.conf
216(a make(1) Makefile) in this manner is not right, and will not work
217for anyone who uses any make(1) features in /etc/mk.conf.
218
219---cut here---
220#!/bin/sh
221. /etc/mk.conf
222
223if [ -z $BSDSRCDIR ] ; then
224    BSDSRCDIR=/usr/src
225fi
226if [ \! -d $BSDSRCDIR ] ; then
227    echo Unable to find sources
228    exit 1
229fi
230find $BSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
231
232if [ -z $BSDOBJDIR ] ; then
233    BSDOBJDIR=/usr/obj
234fi
235if [ -d $BSDOBJDIR ] ; then
236    rm -rf $BSDOBJDIR
237fi
238
239cd $BSDSRCDIR && make cleandir
240
241---cut here---
242
243Critical utilities:
244^^^^^^^^^^^^^^^^^^^
245	gnu/usr.bin/egcs
246	usr.bin/compile_et
247	usr.bin/make
248	usr.bin/yacc
249	usr.bin/lex
250	usr.bin/xlint
251	usr.sbin/config
252
253Other problems and possible solutions:
254^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
255Symptom:Unreasonable compiler errors.
256Fix:	Rebuild gnu/usr.bin/egcs
257
258Symptom:Complaints involving a Makefile.
259Fix:	Rebuild usr.bin/make:
260	cd usr.bin/make && make && make install
261        Or, a failsafe method if that doesn't work:
262	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
263
264Fix:	Make sure .mk files are up to date.
265	cd share/mk && make install
266
267Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
268Fix:	Rebuild usr.sbin/config
269
270Symptom:
271Fix:	Rebuild usr.bin/yacc
272
273Symptom:
274Fix:	Rebuild usr.bin/lex
275
276Symptom:
277Fix:	rm /usr/lib/libbfd.a
278
279Symptom:Obsolete intermediate files are used during compilation
280Fix:	Try the following sequence of commands in the directory in question.
281	make cleandir; rm `make print-objdir`; make cleandir; make obj
282	(If you built the tree without "make obj" in the past, obsolete files
283	may remain.  The command tries to clean everything up)
284
285Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
286Fix:	Rebuild and install usr.bin/menuc
287
288Symptom:mklocale not found during build in share/locale/ctype
289Fix:	Build and install usr.bin/mklocale
290
291Symptom:undefined reference to `__assert13'
292Fix:    Rebuild and install lib/libc
293
294Symptom:usr.sbin/config fails to build.
295Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
296
297Symptom:undefined reference to `getprogname' or `setprogname'
298Fix:    Rebuild and install lib/libc
299
300Symptom:lint does not understand the '-X' option
301Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
302