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