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