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