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