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