UPDATING revision 1.129 1 $NetBSD: UPDATING,v 1.129 2004/10/12 04:03:20 jmc Exp $
2
3 This file (UPDATING) is intended to be a brief reference to recent
4 changes that might cause problems in the build process, and a guide for
5 what to do if something doesn't work.
6
7 For a more detailed description of the recommended way to build NetBSD
8 using build.sh, see the BUILDING file.
9
10 Note that much of the advice in this UPDATING file was written before
11 build.sh existed. Nevertheless, the advice here may be useful for
12 working around specific problems with build.sh.
13
14 See also: BUILDING, build.sh, Makefile.
15
16 Recent changes:
17 ^^^^^^^^^^^^^^^
18
19 20041006:
20
21 A bug was introduced into /bin/sh (var.c rev 1.35) which causes
22 variables to not export correctly to subshells in all cases. This
23 will cause builds to break if that version of /bin/sh is installed
24 on the system. The proper version of /bin/sh can be verified with:
25
26 ident /bin/sh | grep var
27
28 Any /bin/sh w. version 1.35 will not work and needs to be updated
29 before attempting a build.
30
31 20041001:
32 The ipfilter kernel sources moved from sys/netinet to
33 dist/sys/ipf/netinet. Due to the move some Makefile
34 dependencies are now dangling requiring a make cleandir
35 before they work again (kdump, ktruss, rescue, ipf, and
36 ftp-proxy are the victims).
37
38 20040715:
39 The rc.d/sendmail script now uses a heuristic to determine
40 if sendmail should be started at boot time. It checks the
41 contents of /etc/mailer.conf, /etc/mail/submit.cf, and the
42 owner and mode of the sendmail binary to see if any changes
43 to the mail infrastructure have been made. If no changes
44 are detected, it will start an SMTP listener.
45
46 Setting sendmail=NO in /etc/rc.conf will override this.
47
48 If you are only using sendmail by default and only for
49 local delivery, it is important that you also update your
50 sendmail.cf so that the SMTP listener only listens on the
51 loopback interface.
52
53 20040715:
54 The method by which athhal-elf.o gets pulled into i386
55 kernel builds has been changed again. The latest version
56 of bsd.files.mk is no longer required.
57
58 20040621:
59 Due to the recent rototill of tools/compat it's crucial one starts
60 from a clean objdir under tools/*.
61
62 This is mostly due to generated files (yacc and lex sources) needing
63 to be generated with new rules from bsd.hostprog.mk.
64
65 The safest course is to rm -rf all objects under tools before building.
66
67 20040516:
68 The end-user modifiable X11 configuration has been moved
69 from /usr/X11R6/lib/X11/<dir> to /etc/X11/<dir>.
70 Ensure that src and xsrc is up to date, and run
71 "make cleandir" in src/x11 before your next build.
72
73 postinstall currently doesn't migrate the files from
74 /usr/X11R6/lib/X11/* to /etc/X11/* although it does
75 detect that this needs to occur, so you'll have to
76 manually move these files yourself.
77
78 20040426:
79 Support for the original dynamic sysctl node structure has
80 been removed in favor of the newer layout. This affects
81 consumers of the create and delete interface, as well as
82 the dynamic discovery mechanism. This is believed only to
83 be the sysctl(8) binary itself, at this point in time, so
84 the only effect of this should be that a sysctl binary
85 built from sources dated between 2003/12/04 and 2004/03/24
86 will not work on a kernel built from sources dated after
87 2004/04/25. If you need a new sysctl binary but build.sh
88 does not work, make sure that your revision of
89 src/sys/sys/sysctl.h is 1.112 (or later), and then the
90 do the following:
91
92 cd /usr/src (or wherever your source tree is)
93 make USETOOLS=no includes
94 cd lib/libc
95 make USETOOLS=no dependall install
96 cd ../../sbin/sysctl
97 make USETOOLS=no dependall install
98
99 If you are using older sysctl binary, GNU autoconf would fail to
100 identify your machine architecture, and tries to build binary for
101 "unknown-unknown-netbsd20F" or something like that. if that happens,
102 make sure to follow the above steps.
103
104 20040425:
105 The ffs superblock issues listed below under 20040109 and 20030402
106 are now automatically addressed by the /etc/rc.d/fixsb script or by
107 sysinst when it checks a a filesystem. The manual fsck_ffs -b16 -c4
108 invocation mentioned below will continue to work and is now
109 automated by those scripts. Note that under certain circumstances,
110 affected filesystems upgraded to a -current kernel first before
111 upgrading their userland with the fixsb and fsck_ffs fixes may
112 encounter a 'freeing free inode' panic when writing to the affected
113 filesystem, so it is a good idea to repair the filesystem as soon as
114 possible. For more details on the fixsb script, see pr install/25138.
115
116 20040418:
117 statfs(2) and friends have been replaced with statvfs(2). Before
118 installing a newly build userland make sure that you are running
119 a newly built kernel with COMPAT_20 set. In addition your libc
120 build might not work (undefined SYS_statfs symbol) because make
121 clean does not know how to remove files it does not know about
122 anymore. Manually remove all generated .S sources and objects
123 from the libc build directory.
124
125 20040326:
126 The method by which athhal-elf.o gets pulled into i386 kernel builds
127 has been changed. The file is now stored as a uuencoded file in CVS
128 and the generated Makefile will use the new .uue rules from bsd.file.mk
129 to build it.
130
131 This means you must have the latest bsd.files.mk installed when
132 building a kernel without USETOOLS=yes.
133
134 20040318:
135 A bug in the cgd(4) blowfish code was corrected, without
136 provision of backwards compatibility, after several public
137 notices over several months. Users of cgd with blowfish cipher
138 ONLY must dump their data before updating their kernels, and
139 recreate cgd's and restore data using the new kernel. See
140 (recent message to current-users, URL when mail-index has updated)
141
142 20040313:
143 On acorn32, the opms and qms drivers have been withdrawn, and
144 the old wsqms driver is now called qms. Kernel config files
145 will need updating. See the ones in sys/arch/acorn32/conf
146 for examples.
147
148 20040125:
149 On acorn32, the beep and sysbeep devices are no longer
150 needed, and will need to be deleted from kernel configuration
151 files.
152
153 20040109:
154 Compatibility for old ffs superblock layouts has been
155 added, and the restrictive fsck checks have been reenabled
156 when using those layouts. If you have been using -current
157 since 20030402, you may find that fsck again signals fatal
158 superblock mismatches. To repair, make sure you have
159 an updated fsck_ffs and then you can use fsck_ffs -b 16 -c 4
160 to complete the filesystem upgrade. A message has
161 been added to the kernel which should detect this problem.
162 See the following discussion for more information:
163 http://mail-index.NetBSD.org/current-users/2004/01/11/0022.html
164
165 20031203:
166 New binutils builds may fail due to old dependencies.
167 It's necessary to "make cleandir" to ensure that
168 the dependencies will be rebuilt correctly.
169
170 20031111:
171 A newer mkdep is needed. Error noting that is
172 cc: Ambiguous abbreviation --
173
174 20031008:
175 /usr/include/sys/disklabel_mbr.h was removed.
176 It's necessary to "make cleandir" to ensure that
177 the dependencies will be rebuilt correctly.
178
179 20031007:
180 A sign exension bug was fixed which set all the high bits
181 of our newly expanded ffs fs_flags. This should only
182 affect users who installed or upgraded in September of 2003.
183 A small utility program was posted to tech-kern which
184 should fix this problem, and a warning message was added
185 to the kernel which should discover and warn about it. See
186 http://mail-index.NetBSD.org/tech-kern/2003/10/07/0005.html
187
188 20030906:
189 With the addition of siginfo support the old signal trampoline
190 code has been deprecated to COMPAT_16. Make sure that your running
191 kernel has COMPAT_16 enabled before building userland.
192
193 20030801:
194 With the new openssl, there is some header and library shuffling.
195 rm -f /usr/include/des.h /usr/include/kerberosIV/* /lib/libdes* \
196 /usr/lib/libdes* before building.
197
198 20030703:
199 Texinfo was updated to 4.6. To avoid failures when trying to
200 build the included texinfo files, do:
201
202 cd src/gnu/usr.bin/texinfo
203 make MKINFO=no dependall install
204
205 20030630:
206 Groff was updated to 1.19; it's probably necessary to do
207 cd share/mk && make install
208 cd src/gnu/usr.bin/groff
209 make MKMAN=no dependall install
210 (untested).
211
212 20030516:
213 Due to bugs in the export handling code, invalid export lines
214 were accepted before and caused the kernel to panic when
215 mountd got restarted because it freed memory that had already
216 been freed. This has been fixed and the kernel checks
217 export addresses very strictly. If you upgrade your kernel,
218 make sure you also upgrade mountd, because if your export
219 file contains lines with an old inet4 address syntax (i.e.
220 a.b.c or a.b or a), they will get rejected by the new kernel.
221
222 20030402:
223 The superblock layout for FFS was changed. If you have 1.6
224 fsck binaries, they will signal a fatal superblock mismatch
225 with the first alternate, because they compare too many
226 fields (even ones that aren't useful). If possible, upgrade
227 your fsck_ffs binary before using a new kernel.
228 None of this signals actual filesystem damage.
229
230 20030324:
231 sendmail version 8.12.8 was imported. Since sendmail is
232 now setgid to the smmsp group, and runs in "collection"
233 mode for most common activities, there is a new config
234 file called submit.cf that needs to live in /etc/mail.
235 The generic submit.cf sample in /usr/share/sendmail/cf
236 is named netbsd-msp.cf. Upgrading your regular sendmail
237 configuration file is also strongly advised.
238
239 See the section named "MESSAGE SUBMISSION PROGRAM" in
240 the updated /usr/share/sendmail/README file for more
241 information.
242
243 20030117:
244 Texinfo was updated to 4.3. To avoid failures when trying to
245 build the included texinfo files, do:
246
247 cd src/gnu/usr.bin/texinfo
248 make MKINFO=no dependall install
249
250 20021223:
251 The METALOG format changed slightly, to remove the leading
252 "${DESTDIR}" from path names.
253 This only affects people building with UNPRIVED.
254 For complete safety, remove the DESTDIR entirely and
255 update tools/mtree, before running make build.
256
257 20021219:
258 CVS repository layout was changed. See the following for details
259 if you are using (anonymous) cvs to update your tree.
260
261 http://mail-index.NetBSD.org/netbsd-announce/2002/12/19/0000.html
262
263 20021219:
264 install(1) had a '-N dbdir' option added, to specify an
265 alternate location to look up users & groups (instead
266 of the host system passwd(5) and group(5) databases).
267
268 The build system was modified to take advantage of
269 this option (using ${NETBSDSRCDIR}/etc), so if you
270 use USETOOLS==no, you may have to rebuild and
271 reinstall usr.bin/xinstall first.
272
273 20021130:
274 fparseln(3) moved from libutil to libc.
275 If building to DESTDIR=/, reinstall the includes
276 and rebuild libc:
277 make includes
278 make do-lib-libc
279 If using build.sh, "cd tools/compat && make clean"
280 before rebuilding the tools.
281
282 20021126:
283 The mk.conf(5) variable SYS_INCLUDE has been deprecated,
284 including the optional "SYS_INCLUDE=symlinks" support.
285 All header files, including <sys/*.h> are copied into
286 /usr/include.
287
288 20021121:
289 The C run-time support files crtbegin.o and crtend.o
290 (and their companions crtbeginS.o and crtendS.o) were
291 split up, with new crti.o and crtn.o files resulting.
292 This means that libtool needs to be rebuilt once the
293 new libraries are installed. The process of rebuilding
294 libtool will cause it to automatically notice the new
295 required files, but it *must* be rebuilt in order to
296 do this.
297
298 An out-of-date libtool will result in shared libraries
299 which lack _init() and _fini() routines, which means that
300 their global contructors/destructors will not be invoked.
301
302 20021121:
303 A bug related to how ARM ELF objects were tagged has been
304 corrected.
305
306 NetBSD ARM ELF uses the soft-VFP floating point model by
307 default. However, the assembler lacked support for marking
308 objects as using the VFP floating point format, and the
309 compiler was not properly passing the flag indicating "soft-VFP"
310 to the assembler.
311
312 Unfortunately, this means that the linker will now consider
313 old (i.e. not marked "softvfp") NetBSD ARM ELF objects to be
314 incompatible with new (properly marked) objects.
315
316 The problem will only manifest itself if you attempt to compile
317 a new program using the fixed toolchain, and link that program
318 against old libraries which do not have the proper "softvfp"
319 markings. ALL OF YOUR EXISTING BINARIES AND SHARED LIBRARIES
320 WILL CONTINUE TO WORK PROPERLY.
321
322 The only work-around for the problem is to recompile all of
323 the libraries on the system. The easiest way to do this for
324 system libraries is to install a binary snapshot; they are
325 generally available on releng.NetBSD.org. Any packages you
326 have installed which supply libraries will have to be recompiled
327 if you wish to link new programs against those libraries.
328
329 If you have questions about this matter, please contact
330 port-arm (a] NetBSD.org.
331
332 20021011:
333 Systrace has been improved to support privilege elevation.
334 Updating the kernel requires the userland part of systrace
335 to be rebuilt.
336
337 20021010:
338 The config(8) grammar was changed to allow options to register
339 dependencies on attributes, as well as other options. Users
340 must update and reinstall usr.sbin/config before building a new
341 kernel.
342
343 20021009:
344 A new attribute dependency syntax was introduced to config(8),
345 which is now used by the SCSI configuration description. Users
346 must update and reinstall usr.sbin/config before building a new
347 kernel.
348
349 20021003:
350 Several changes have been made to the autoconfiguration
351 framework. Users must update and reinstall usr.sbin/config
352 before building a new kernel.
353
354 20021001:
355 The i386mp branch has been merged. To compile a kernel, users
356 will need to add the option 'cpu* at mainbus?' to their configuration
357 file. Multiprocessor kernels will need
358 ioapic* at mainbus? apid ?
359 options MULTIPROCESSOR
360 options COM_MPLOCK
361
362 20020922:
363 MKDYNAMICROOT=yes enabled by default, which means that
364 certain shared libraries are installed into /lib, the shared
365 linker is installed into /libexec, and all programs in /bin
366 and /sbin are dynamically linked.
367 If you do not use "make build", you should ensure that
368 you have the libraries and shared linker in the new locations,
369 with:
370 make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so
371
372 20020917:
373 USE_NEW_TOOLCHAIN has been replaced with:
374 - TOOLCHAIN_MISSING -- set to "yes" on platforms for which
375 there is no working in-tree toolchain (hppa, ns32k, sh5,
376 x86_64).
377 - EXTERNAL_TOOLCHAIN -- if defined by the user, points to the
378 root of an external toolchain (e.g. /usr/local/gnu). This
379 enables the cross-build framework even for TOOLCHAIN_MISSING
380 platforms.
381
382 20020906:
383 gehenna-devsw has been merged into the trunk. Need to update and
384 reinstall usr.sbin/config before building the kernel.
385
386 20020822:
387 Crunched rescue tools (contents of /bin and /sbin, plus others)
388 are now provided in /rescue.
389
390 To ensure that these are built statically linked (no matter
391 what the setting of LDSTATIC is), use a crunchgen(1) built
392 from sources newer than 20020820 (see the next entry).
393
394 20020820:
395 crunchgen(1) changed to ensure that the generated program
396 is statically linked.
397
398 Solution: update and reinstall usr.bin/crunch
399
400 20020605:
401 smmsp user/group has been added for sendmail.
402
403 Add the following into /etc/group:
404
405 smmsp:*:17:
406
407 and the following to /etc/master.passwd (via vipw):
408
409 smmsp:*:17:17::0:0:Sendmail Message Submission Program:/nonexistent:/sbin/nologin
410
411 20020515:
412 sshd user/group has been added. Need to hand add this in, or sshd
413 will not let you log in (with default, or UsePrivlegeSeparation=yes)
414
415 Add the following into /etc/group:
416
417 sshd:*:16:
418
419 and the following to /etc/master.passwd (via vipw):
420
421 sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
422
423 Also /var/chroot/sshd directory needs to be present (digged as part of
424 the build process).
425
426 20020426:
427 NBUILDJOBS obsoleted in favor of just using -j.
428
429 20020426:
430 etc/postinstall added, which performs various checks for
431 configuration file updates and changes, and can fix most of
432 the problems identified.
433 This should make it much easier to upgrade a system's
434 configuration from earlier systems (as far back as NetBSD 1.5).
435
436 20020320:
437 <bsd.lib.mk> needs a new install(1) for its "-a cmd" support.
438 Build and install at usr.bin/xinstall before the build.
439
440 20020319:
441 Raw IPv6 socket now makes strict checking for sa_family and sa_len
442 on send(2) operation. Be sure to have sbin/rtsol and usr.sbin/rtsold
443 newer than November 2001 when you upgrade the kernel.
444
445 20020311:
446 ssh configuration files were moved from /etc to /etc/ssh. Beware
447 if you restart your machine from remote. Note that sshd.conf needs
448 to be changed (due to the use of "/etc" inside).
449
450 20020223:
451 Users of the VAX port will need to rebuild and install gas
452 so it deal with the now present register prefix used in all
453 the VAX assembly files.
454
455 20020118:
456 ntpd user/group has been added. Need to hand add this in or builds
457 will break as mtree aborts early.
458
459 Add the following into /etc/group:
460
461 ntpd:*:15:
462
463 and the following to /etc/master.passwd (via vipw):
464
465 ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
466
467 20011207:
468 If you're attempting to build a snapshot on sparc64 and are getting
469 reloc errors from the toolchain groff binary this means your native
470 toolchain has some broken C++ bits.
471
472 To fix:
473
474 Build a new toolchain (i.e. build.sh -t)
475 Use the new toolchain to build and install natively (i.e. /usr/lib)
476
477 gnu/lib/libgcc
478 gnu/lib/libstdc++
479
480 After this a snapshot will be able to be built.
481
482 20011201:
483 In order for a sparc64 build to work you must have a working awk. If
484 you've built and installed a system with the new toolchain up to this
485 point you do not have a working awk as its ability to do floating
486 point is broken.
487
488 To build:
489
490 remake and install gnu/lib/libgcc
491 remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
492 against the new libgcc.a)
493
494 20011128:
495 Kernel config information was changed to use defflag in
496 the various "files" files. Bug fixes to config(8) are
497 required in order for this to work properly. Make sure
498 to build and install in usr.sbin/config before attempting
499 to build a new kernel.
500
501 20011030:
502 libc/locale/wcstod.c now needs new lint(1). Update lint(1)
503 before building libc.
504
505 20011029:
506 The new document BUILDING.mdoc (view with nroff | more, or
507 see pre-generated .txt and .html versions) describes the build
508 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN
509 build process, are intended in the long run to replace this
510 manual update log.
511
512 Users building a USE_NEW_TOOLCHAIN system should read the
513 BUILDING document for caveats. Generally, BUILDING supersedes
514 UPDATING for these systems, as tool updating is taken care of
515 by the new build system.
516
517 20011028:
518 src/etc/Makefile now needs install to be able to handle
519 symlinks that point to nowhere. A bug in install that
520 prevented this was corrected.
521
522 Solution: update and reinstall usr.bin/xinstall
523 Better Solution: Use the new toolchain and it will just work
524 for you.
525
526 20011006:
527 /etc/mtree/NetBSD.dist has been updated to take advantage of
528 absolute path support added to mtree(8). Older mtree(8)s don't
529 understand the format.
530
531 Solution: update and reinstall usr.sbin/mtree
532
533 20011004:
534 Crunchgen has been updated to work via reach-over makefiles. Updating
535 is suggested before running a snapshot build
536
537 20010915:
538 The new "ubcperf" code committed by Chuck Silvers removed
539 a header file, uvm/uvm_vnode.h. There may be stale .depend
540 files that still reference this file.
541
542 Solution: "make cleandir && make dependall" in affected
543 directories.
544
545 20010803:
546 grep.info is now built from grep.texi using makeinfo. Since it
547 requires makeinfo v4.0, you need to install new texinfo before
548 building gnu/usr.bin/grep. To install new texinfo, please follow
549 the instruction described in 20010726 entry.
550
551 20010803:
552 (i386 only): i386 kernel now uses new instructions like
553 `fxsave' which old gas doesn't understand. To build the
554 kernel successfully, you need to build and install a new toolchain,
555 (i.e., build.sh -t) or (temporarily) comment out "options I686_CPU"
556 from your kernel configuration until you rebuild your userland.
557 See 20011029 above and BUILDING file in this directory for more information.
558 [updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
559
560 20010731:
561 Bootloader update on ELF platforms. DDB in kernels from before
562 this will be unable to read symbol tables provided by newer
563 bootloaders.
564
565 20010726:
566 Texinfo was updated to 4.0. To avoid failures when trying to
567 build the included texinfo files, do:
568
569 cd src/gnu/usr.bin/texinfo
570 make MKINFO=no dependall install
571
572 20010718:
573 Enabled correct .init/.fini processing in crt0. The way this
574 was done was to change a -I directive to cc(1), which means
575 make(1) will have a stale dependency (it will be checking the
576 timestamp on the wrong "dot_init.h").
577
578 The symptom you will see is that new programs die with SIGSEGV
579 if you have a stale dependency.
580
581 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
582 before starting your build.
583
584 20010628:
585 A construct was added to uvm_page.h that uncovered a bug
586 in lint(1). If you get a warning/error about a non-portable
587 bitfield, update your lint(1) before proceeding.
588
589 20010226:
590 Added named user/group to system. Need to hand add this in or builds
591 will break as mtree aborts early.
592
593 To work around add by hand:
594
595 named:*:14:
596
597 to /etc/group and add:
598
599 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
600
601 to master.passwd (use vipw for instance if doing by hand).
602
603 Now a make build should progress.
604
605 20010219:
606 get/setprogname() added. Any hostprogs that may use this will need
607 to be bootstrapped manually until the host system is current.
608
609 Known problems: sys/arch/macppc/stand/fixcoff
610 usr.sbin/config (adding -DMAKE_BOOTSTRAP to
611 CFLAGS and rebuilding should work)
612 usr.sbin/mdsetimage - Build a static copy if
613 building a snapshot before fully bootstrapped.
614
615 20010204:
616 prepare the code to compile with stricter gcc flags. in
617 particular start eliminating redundant declarations. Yacc
618 needs to be installed before make build.
619
620 20010114:
621 introduce .if commands(target) in make(1). You need to
622 bring everything up-to-date first, then without installing
623 anything make and install in usr.bin/make, then proceed
624 with make build.
625
626 20010101:
627 bsd.subdir.mk committed 20001230 had a bug which caused
628 afterinstall targets to run too soon; update again.
629
630 20001230:
631 New share/mk files needed to support .WAIT in SUBDIR variables.
632 If you get make errors,
633 (cd share/mk; make install)
634 Also, PRINTOBJDIR has changed and is now used more heavily.
635
636 20001019:
637 The `ca' device driver has been replaced by `ld'; although the
638 major and minor numbers haven't changed, you should update your /dev
639 directory.
640
641 20000929:
642 The following make directives are obsoleted.
643 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA
644 By default, RSA is built into libcrypto. IDEA and RC5 will not be
645 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build
646 additional library libcrypto_{idea,rc5}.
647
648
649 Hints for a more successful build:
650 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
651 Use build.sh, but do not use its "expert mode":
652 This will will automatically build the tools in the
653 correct order, and it will keep the tools and the
654 new build products from interfering with the running
655 system. This will allow you to ignore most of the
656 other advice in this file.
657 Build a new kernel first:
658 This makes sure that any new system calls or features
659 expected by the new userland will be present. This
660 helps to avoid critical errors when upgrading.
661 Use object directories:
662 This helps to keep stale object
663 files from polluting the build if a Makefile "forgets"
664 about one. It also makes it easier to clean up after
665 a build. It's also necessary if you want to use the
666 same source tree for multiple machines.
667 To use object directories with build.sh:
668 a) invoke build.sh with the "-M" or "-O" options.
669 To use object directories without using build.sh:
670 a) cd /usr/src ; make cleandir
671 b) Add "OBJMACHINE=yes" to /etc/mk.conf
672 c) Add "MKOBJDIRS=yes" to /etc/mk.conf
673 d) cd /usr/src ; make build
674 Note that running "make obj" in a directory will create
675 in obj.$MACHINE directory.
676 Build to a DESTDIR:
677 This helps to keep old installed files (especially libraries)
678 from interfering with the new build.
679 To build to a DESTDIR with build.sh, use the "-D" option.
680 To build to a DESTDIR without using build.sh, set the DESTDIR
681 environment variable before running make build. It should be
682 set to the pathname of an initially empty directory.
683 Problems: if you do not use build.sh, you might need to
684 update critical utilities without using DESTDIR since
685 nothing is executed from what is installed in DESTDIR.
686 (See critical utils, below.)
687 Build often:
688 This keeps critical utilities current enough to not choke
689 on any other part of the source tree that depends on up to
690 date functionality. If you use build.sh, you should not have
691 this problem.
692
693 What to do if things don't work:
694 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
695 When things don't work there is usually a few things that commonly
696 should be done.
697 1) make includes
698 This should be done automatically by make build.
699 2) cd share/mk && make install
700 Again, automatically done by make build.
701
702 Failsafe rebuild of a small part of the tree:
703 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
704 To make sure you rebuild something correctly you want to do
705 something like the following:
706 1) Make sure the includes and .mk files are up to date.
707 2) Make sure any program used to build the particular
708 utility is up to date. (yacc, lex, etc...)
709 3) cd ...path/to/util...
710 make cleandir
711 rm ...all obj directories...
712 make cleandir # yes, again
713 make obj
714 make depend && make
715
716 Failsafe rebuild of the entire tree:
717 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
718 If you really want to make sure the source tree is clean and
719 ready for a build try the following. Note that sourcing /etc/mk.conf
720 (a make(1) Makefile) in this manner is not right, and will not work
721 for anyone who uses any make(1) features in /etc/mk.conf.
722
723 ---cut here---
724 #!/bin/sh
725 . /etc/mk.conf
726
727 if [ -z $NETBSDSRCDIR ] ; then
728 NETBSDSRCDIR=/usr/src
729 fi
730 if [ \! -d $NETBSDSRCDIR ] ; then
731 echo Unable to find sources
732 exit 1
733 fi
734 find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
735
736 if [ -z $BSDOBJDIR ] ; then
737 BSDOBJDIR=/usr/obj
738 fi
739 if [ -d $BSDOBJDIR ] ; then
740 rm -rf $BSDOBJDIR
741 fi
742
743 cd $NETBSDSRCDIR && make cleandir
744
745 ---cut here---
746
747 Critical utilities:
748 ^^^^^^^^^^^^^^^^^^^
749 gnu/usr.bin/egcs
750 usr.bin/compile_et
751 usr.bin/make
752 usr.bin/yacc
753 usr.bin/lex
754 usr.bin/xlint
755 usr.sbin/config
756
757 Other problems and possible solutions:
758 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
759 Symptom:Unreasonable compiler errors.
760 Fix: Rebuild gnu/usr.bin/egcs
761
762 Symptom:Complaints involving a Makefile.
763 Fix: Rebuild usr.bin/make:
764 cd usr.bin/make && make && make install
765 Or, a failsafe method if that doesn't work:
766 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
767
768 Fix: Make sure .mk files are up to date.
769 cd share/mk && make install
770
771 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
772 Fix: Rebuild usr.sbin/config
773
774 Symptom:
775 Fix: Rebuild usr.bin/yacc
776
777 Symptom:
778 Fix: Rebuild usr.bin/lex
779
780 Symptom:
781 Fix: rm /usr/lib/libbfd.a
782
783 Symptom:Obsolete intermediate files are used during compilation
784 Fix: Try the following sequence of commands in the directory in question.
785 make cleandir; rm `make print-objdir`; make cleandir; make obj
786 (If you built the tree without "make obj" in the past, obsolete files
787 may remain. The command tries to clean everything up)
788
789 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
790 Fix: Rebuild and install usr.bin/menuc
791
792 Symptom:mklocale not found during build in share/locale/ctype
793 Fix: Build and install usr.bin/mklocale
794
795 Symptom:undefined reference to `__assert13' or `__unsetenv13'
796 Fix: Rebuild and install lib/libc
797
798 Symptom:usr.sbin/config fails to build.
799 Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
800
801 Symptom:undefined reference to `getprogname' or `setprogname'
802 Fix: Rebuild and install lib/libc
803
804 Symptom:lint does not understand the '-X' option
805 Fix: May need to build & install libs with NOLINT=1 before rebuilding lint
806