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