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