UPDATING revision 1.106
1$NetBSD: UPDATING,v 1.106 2004/01/25 14:13:08 bjh21 Exp $ 2 3This file is intended to be a brief introduction to the build 4process and a reference on what to do if something doesn't work. 5 6For a more detailed description see Makefile. 7 8Recent changes: 9^^^^^^^^^^^^^^^ 10 1120040125: 12 On acorn32, the beep and sysbeep devices are no longer 13 needed, and will need to be deleted from kernel configuration 14 files. 15 1620040109: 17 Compatibility for old ffs superblock layouts has been 18 added, and the restrictive fsck checks have been reenabled 19 when using those layouts. If you have been using -current 20 since 20030402, you may find that fsck again signals fatal 21 superblock mismatches. To work around, you can use 22 fsck_ffs -b 32 -c 4 to restore an alternate superblock 23 and complete the filesystem upgrade. 24 2520031203: 26 New binutils builds may fail due to old dependencies. 27 It's necessary to "make cleandir" to ensure that 28 the dependencies will be rebuilt correctly. 29 3020031111: 31 A newer mkdep is needed. Error noting that is 32 cc: Ambiguous abbreviation -- 33 3420031008: 35 /usr/include/sys/disklabel_mbr.h was removed. 36 It's necessary to "make cleandir" to ensure that 37 the dependencies will be rebuilt correctly. 38 3920030906: 40 With the addition of siginfo support the old signal trampoline 41 code has been deprecated to COMPAT_16. Make sure that your running 42 kernel has COMPAT_16 enabled before building userland. 43 4420030801: 45 With the new openssl, there is some header and library shuffling. 46 rm -f /usr/include/des.h /usr/include/kerberosIV/* /lib/libdes* \ 47 /usr/lib/libdes* before building. 48 4920030703: 50 Texinfo was updated to 4.6. To avoid failures when trying to 51 build the included texinfo files, do: 52 53 cd src/gnu/usr.bin/texinfo 54 make MKINFO=no dependall install 55 5620030630: 57 Groff was updated to 1.19; it's probably necessary to do 58 cd share/mk && make install 59 cd src/gnu/usr.bin/groff 60 make MKMAN=no dependall install 61 (untested). 62 6320030516: 64 Due to bugs in the export handling code, invalid export lines 65 were accepted before and caused the kernel to panic when 66 mountd got restarted because it freed memory that had already 67 been freed. This has been fixed and the kernel checks 68 export addresses very strictly. If you upgrade your kernel, 69 make sure you also upgrade mountd, because if your export 70 file contains lines with an old inet4 address syntax (i.e. 71 a.b.c or a.b or a), they will get rejected by the new kernel. 72 7320030402: 74 The superblock layout for FFS was changed. If you have 1.6 75 fsck binaries, they will signal a fatal superblock mismatch 76 with the first alternate, because they compare too many 77 fields (even ones that aren't useful). If possible, upgrade 78 your fsck_ffs binary before using a new kernel. 79 None of this signals actual filesystem damage. 80 8120030324: 82 sendmail version 8.12.8 was imported. Since sendmail is 83 now setgid to the smmsp group, and runs in "collection" 84 mode for most common activities, there is a new config 85 file called submit.cf that needs to live in /etc/mail. 86 The generic submit.cf sample in /usr/share/sendmail/cf 87 is named netbsd-msp.cf. Upgrading your regular sendmail 88 configuration file is also strongly advised. 89 90 See the section named "MESSAGE SUBMISSION PROGRAM" in 91 the updated /usr/share/sendmail/README file for more 92 information. 93 9420030117: 95 Texinfo was updated to 4.3. To avoid failures when trying to 96 build the included texinfo files, do: 97 98 cd src/gnu/usr.bin/texinfo 99 make MKINFO=no dependall install 100 10120021223: 102 The METALOG format changed slightly, to remove the leading 103 "${DESTDIR}" from path names. 104 This only affects people building with UNPRIVED. 105 For complete safety, remove the DESTDIR entirely and 106 update tools/mtree, before running make build. 107 10820021219: 109 CVS repository layout was changed. See the following for details 110 if you are using (anonymous) cvs to update your tree. 111 112 http://mail-index.NetBSD.org/netbsd-announce/2002/12/19/0000.html 113 11420021219: 115 install(1) had a '-N dbdir' option added, to specify an 116 alternate location to look up users & groups (instead 117 of the host system passwd(5) and group(5) databases). 118 119 The build system was modified to take advantage of 120 this option (using ${NETBSDSRCDIR}/etc), so if you 121 use USETOOLS==no, you may have to rebuild and 122 reinstall usr.bin/xinstall first. 123 12420021130: 125 fparseln(3) moved from libutil to libc. 126 If building to DESTDIR=/, reinstall the includes 127 and rebuild libc: 128 make includes 129 make do-lib-libc 130 If using build.sh, "cd tools/compat && make clean" 131 before rebuilding the tools. 132 13320021126: 134 The mk.conf(5) variable SYS_INCLUDE has been deprecated, 135 including the optional "SYS_INCLUDE=symlinks" support. 136 All header files, including <sys/*.h> are copied into 137 /usr/include. 138 13920021121: 140 The C run-time support files crtbegin.o and crtend.o 141 (and their companions crtbeginS.o and crtendS.o) were 142 split up, with new crti.o and crtn.o files resulting. 143 This means that libtool needs to be rebuilt once the 144 new libraries are installed. The process of rebuilding 145 libtool will cause it to automatically notice the new 146 required files, but it *must* be rebuilt in order to 147 do this. 148 149 An out-of-date libtool will result in shared libraries 150 which lack _init() and _fini() routines, which means that 151 their global contructors/destructors will not be invoked. 152 15320021121: 154 A bug related to how ARM ELF objects were tagged has been 155 corrected. 156 157 NetBSD ARM ELF uses the soft-VFP floating point model by 158 default. However, the assembler lacked support for marking 159 objects as using the VFP floating point format, and the 160 compiler was not properly passing the flag indicating "soft-VFP" 161 to the assembler. 162 163 Unfortunately, this means that the linker will now consider 164 old (i.e. not marked "softvfp") NetBSD ARM ELF objects to be 165 incompatible with new (properly marked) objects. 166 167 The problem will only manifest itself if you attempt to compile 168 a new program using the fixed toolchain, and link that program 169 against old libraries which do not have the proper "softvfp" 170 markings. ALL OF YOUR EXISTING BINARIES AND SHARED LIBRARIES 171 WILL CONTINUE TO WORK PROPERLY. 172 173 The only work-around for the problem is to recompile all of 174 the libraries on the system. The easiest way to do this for 175 system libraries is to install a binary snapshot; they are 176 generally available on releng.NetBSD.org. Any packages you 177 have installed which supply libraries will have to be recompiled 178 if you wish to link new programs against those libraries. 179 180 If you have questions about this matter, please contact 181 port-arm@NetBSD.org. 182 18320021011: 184 Systrace has been improved to support privilege elevation. 185 Updating the kernel requires the userland part of systrace 186 to be rebuilt. 187 18820021010: 189 The config(8) grammar was changed to allow options to register 190 dependencies on attributes, as well as other options. Users 191 must update and reinstall usr.sbin/config before building a new 192 kernel. 193 19420021009: 195 A new attribute dependency syntax was introduced to config(8), 196 which is now used by the SCSI configuration description. Users 197 must update and reinstall usr.sbin/config before building a new 198 kernel. 199 20020021003: 201 Several changes have been made to the autoconfiguration 202 framework. Users must update and reinstall usr.sbin/config 203 before building a new kernel. 204 20520021001: 206 The i386mp branch has been merged. To compile a kernel, users 207 will need to add the option 'cpu* at mainbus?' to their configuration 208 file. Multiprocessor kernels will need 209 ioapic* at mainbus? apid ? 210 options MULTIPROCESSOR 211 options COM_MPLOCK 212 21320020922: 214 MKDYNAMICROOT=yes enabled by default, which means that 215 certain shared libraries are installed into /lib, the shared 216 linker is installed into /libexec, and all programs in /bin 217 and /sbin are dynamically linked. 218 If you do not use "make build", you should ensure that 219 you have the libraries and shared linker in the new locations, 220 with: 221 make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so 222 22320020917: 224 USE_NEW_TOOLCHAIN has been replaced with: 225 - TOOLCHAIN_MISSING -- set to "yes" on platforms for which 226 there is no working in-tree toolchain (hppa, ns32k, sh5, 227 x86_64). 228 - EXTERNAL_TOOLCHAIN -- if defined by the user, points to the 229 root of an external toolchain (e.g. /usr/local/gnu). This 230 enables the cross-build framework even for TOOLCHAIN_MISSING 231 platforms. 232 23320020906: 234 gehenna-devsw has been merged into the trunk. Need to update and 235 reinstall usr.sbin/config before building the kernel. 236 23720020822: 238 Crunched rescue tools (contents of /bin and /sbin, plus others) 239 are now provided in /rescue. 240 241 To ensure that these are built statically linked (no matter 242 what the setting of LDSTATIC is), use a crunchgen(1) built 243 from sources newer than 20020820 (see the next entry). 244 24520020820: 246 crunchgen(1) changed to ensure that the generated program 247 is statically linked. 248 249 Solution: update and reinstall usr.bin/crunch 250 25120020605: 252 smmsp user/group has been added for sendmail. 253 254 Add the following into /etc/group: 255 256 smmsp:*:17: 257 258 and the following to /etc/master.passwd (via vipw): 259 260 smmsp:*:17:17::0:0:Sendmail Message Submission Program:/nonexistent:/sbin/nologin 261 26220020515: 263 sshd user/group has been added. Need to hand add this in, or sshd 264 will not let you log in (with default, or UsePrivlegeSeparation=yes) 265 266 Add the following into /etc/group: 267 268 sshd:*:16: 269 270 and the following to /etc/master.passwd (via vipw): 271 272 sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin 273 274 Also /var/chroot/sshd directory needs to be present (digged as part of 275 the build process). 276 27720020426: 278 NBUILDJOBS obsoleted in favor of just using -j. 279 28020020426: 281 etc/postinstall added, which performs various checks for 282 configuration file updates and changes, and can fix most of 283 the problems identified. 284 This should make it much easier to upgrade a system's 285 configuration from earlier systems (as far back as NetBSD 1.5). 286 28720020320: 288 <bsd.lib.mk> needs a new install(1) for its "-a cmd" support. 289 Build and install at usr.bin/xinstall before the build. 290 29120020319: 292 Raw IPv6 socket now makes strict checking for sa_family and sa_len 293 on send(2) operation. Be sure to have sbin/rtsol and usr.sbin/rtsold 294 newer than November 2001 when you upgrade the kernel. 295 29620020311: 297 ssh configuration files were moved from /etc to /etc/ssh. Beware 298 if you restart your machine from remote. Note that sshd.conf needs 299 to be changed (due to the use of "/etc" inside). 300 30120020223: 302 Users of the VAX port will need to rebuild and install gas 303 so it deal with the now present register prefix used in all 304 the VAX assembly files. 305 30620020118: 307 ntpd user/group has been added. Need to hand add this in or builds 308 will break as mtree aborts early. 309 310 Add the following into /etc/group: 311 312 ntpd:*:15: 313 314 and the following to /etc/master.passwd (via vipw): 315 316 ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin 317 31820011207: 319 If you're attempting to build a snapshot on sparc64 and are getting 320 reloc errors from the toolchain groff binary this means your native 321 toolchain has some broken C++ bits. 322 323 To fix: 324 325 Build a new toolchain (i.e. build.sh -t) 326 Use the new toolchain to build and install natively (i.e. /usr/lib) 327 328 gnu/lib/libgcc 329 gnu/lib/libstdc++ 330 331 After this a snapshot will be able to be built. 332 33320011201: 334 In order for a sparc64 build to work you must have a working awk. If 335 you've built and installed a system with the new toolchain up to this 336 point you do not have a working awk as its ability to do floating 337 point is broken. 338 339 To build: 340 341 remake and install gnu/lib/libgcc 342 remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links 343 against the new libgcc.a) 344 34520011128: 346 Kernel config information was changed to use defflag in 347 the various "files" files. Bug fixes to config(8) are 348 required in order for this to work properly. Make sure 349 to build and install in usr.sbin/config before attempting 350 to build a new kernel. 351 35220011030: 353 libc/locale/wcstod.c now needs new lint(1). Update lint(1) 354 before building libc. 355 35620011029: 357 The new document BUILDING.mdoc (view with nroff | more, or 358 see pre-generated .txt and .html versions) describes the build 359 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN 360 build process, are intended in the long run to replace this 361 manual update log. 362 363 Users building a USE_NEW_TOOLCHAIN system should read the 364 BUILDING document for caveats. Generally, BUILDING supersedes 365 UPDATING for these systems, as tool updating is taken care of 366 by the new build system. 367 36820011028: 369 src/etc/Makefile now needs install to be able to handle 370 symlinks that point to nowhere. A bug in install that 371 prevented this was corrected. 372 373 Solution: update and reinstall usr.bin/xinstall 374 Better Solution: Use the new toolchain and it will just work 375 for you. 376 37720011006: 378 /etc/mtree/NetBSD.dist has been updated to take advantage of 379 absolute path support added to mtree(8). Older mtree(8)s don't 380 understand the format. 381 382 Solution: update and reinstall usr.sbin/mtree 383 38420011004: 385 Crunchgen has been updated to work via reach-over makefiles. Updating 386 is suggested before running a snapshot build 387 38820010915: 389 The new "ubcperf" code committed by Chuck Silvers removed 390 a header file, uvm/uvm_vnode.h. There may be stale .depend 391 files that still reference this file. 392 393 Solution: "make cleandir && make dependall" in affected 394 directories. 395 39620010803: 397 grep.info is now built from grep.texi using makeinfo. Since it 398 requires makeinfo v4.0, you need to install new texinfo before 399 building gnu/usr.bin/grep. To install new texinfo, please follow 400 the instruction described in 20010726 entry. 401 40220010803: 403 (i386 only): i386 kernel now uses new instructions like 404 `fxsave' which old gas doesn't understand. To build the 405 kernel successfully, you need to build and install a new toolchain, 406 (i.e., build.sh -t) or (temporarily) comment out "options I686_CPU" 407 from your kernel configuration until you rebuild your userland. 408 See 20011029 above and BUILDING file in this directory for more information. 409 [updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled] 410 41120010731: 412 Bootloader update on ELF platforms. DDB in kernels from before 413 this will be unable to read symbol tables provided by newer 414 bootloaders. 415 41620010726: 417 Texinfo was updated to 4.0. To avoid failures when trying to 418 build the included texinfo files, do: 419 420 cd src/gnu/usr.bin/texinfo 421 make MKINFO=no dependall install 422 42320010718: 424 Enabled correct .init/.fini processing in crt0. The way this 425 was done was to change a -I directive to cc(1), which means 426 make(1) will have a stale dependency (it will be checking the 427 timestamp on the wrong "dot_init.h"). 428 429 The symptom you will see is that new programs die with SIGSEGV 430 if you have a stale dependency. 431 432 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 433 before starting your build. 434 43520010628: 436 A construct was added to uvm_page.h that uncovered a bug 437 in lint(1). If you get a warning/error about a non-portable 438 bitfield, update your lint(1) before proceeding. 439 44020010226: 441 Added named user/group to system. Need to hand add this in or builds 442 will break as mtree aborts early. 443 444 To work around add by hand: 445 446 named:*:14: 447 448 to /etc/group and add: 449 450 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin 451 452 to master.passwd (use vipw for instance if doing by hand). 453 454 Now a make build should progress. 455 45620010219: 457 get/setprogname() added. Any hostprogs that may use this will need 458 to be bootstrapped manually until the host system is current. 459 460 Known problems: sys/arch/macppc/stand/fixcoff 461 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 462 CFLAGS and rebuilding should work) 463 usr.sbin/mdsetimage - Build a static copy if 464 building a snapshot before fully bootstrapped. 465 46620010204: 467 prepare the code to compile with stricter gcc flags. in 468 particular start eliminating redundant declarations. Yacc 469 needs to be installed before make build. 470 47120010114: 472 introduce .if commands(target) in make(1). You need to 473 bring everything up-to-date first, then without installing 474 anything make and install in usr.bin/make, then proceed 475 with make build. 476 47720010101: 478 bsd.subdir.mk committed 20001230 had a bug which caused 479 afterinstall targets to run too soon; update again. 480 48120001230: 482 New share/mk files needed to support .WAIT in SUBDIR variables. 483 If you get make errors, 484 (cd share/mk; make install) 485 Also, PRINTOBJDIR has changed and is now used more heavily. 486 48720001019: 488 The `ca' device driver has been replaced by `ld'; although the 489 major and minor numbers haven't changed, you should update your /dev 490 directory. 491 49220000929: 493 The following make directives are obsoleted. 494 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 495 By default, RSA is built into libcrypto. IDEA and RC5 will not be 496 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 497 additional library libcrypto_{idea,rc5}. 498 499 500Hints for a more successful build: 501^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 502 Build a new kernel first: 503 This makes sure that any new system calls or features 504 expected by the new userland will be present. This 505 helps to avoid critical errors when upgrading. 506 Use object directories: 507 This helps to keep stale object 508 files from polluting the build if a Makefile "forgets" 509 about one. It also makes it easier to clean up after 510 a build. It's also necessary if you want to use the 511 same source tree for multiple machines. 512 To use object directories: 513 a) cd /usr/src ; make cleandir 514 b) Add "OBJMACHINE=yes" to /etc/mk.conf 515 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 516 d) cd /usr/src ; make build 517 Note that running "make obj" in a directory will create 518 in obj.$MACHINE directory. 519 Build to a DESTDIR: 520 This helps to keep old 521 installed files (especially libraries) from interfering 522 with the new build. 523 To build to a DESTDIR, set the DESTDIR environment 524 variable before running make build. It should be set to 525 the pathname of an initially empty directory. 526 Problems: you might need to update critical utilities 527 without using DESTDIR since nothing is executed 528 from what is installed in DESTDIR. 529 (See critical utils, below) 530 Build often: 531 This keeps critical utilities current enough to not choke 532 on any other part of the source tree that depends on up to 533 date functionality. 534 535What to do if things don't work: 536^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 537When things don't work there is usually a few things that commonly 538should be done. 539 1) make includes 540 This should be done automatically by make build. 541 2) cd share/mk && make install 542 Again, automatically done by make build. 543 544Failsafe rebuild of a small part of the tree: 545^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 546To make sure you rebuild something correctly you want to do 547something like the following: 548 1) Make sure the includes and .mk files are up to date. 549 2) Make sure any program used to build the particular 550 utility is up to date. (yacc, lex, etc...) 551 3) cd ...path/to/util... 552 make cleandir 553 rm ...all obj directories... 554 make cleandir # yes, again 555 make obj 556 make depend && make 557 558Failsafe rebuild of the entire tree: 559^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 560If you really want to make sure the source tree is clean and 561ready for a build try the following. Note that sourcing /etc/mk.conf 562(a make(1) Makefile) in this manner is not right, and will not work 563for anyone who uses any make(1) features in /etc/mk.conf. 564 565---cut here--- 566#!/bin/sh 567. /etc/mk.conf 568 569if [ -z $NETBSDSRCDIR ] ; then 570 NETBSDSRCDIR=/usr/src 571fi 572if [ \! -d $NETBSDSRCDIR ] ; then 573 echo Unable to find sources 574 exit 1 575fi 576find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 577 578if [ -z $BSDOBJDIR ] ; then 579 BSDOBJDIR=/usr/obj 580fi 581if [ -d $BSDOBJDIR ] ; then 582 rm -rf $BSDOBJDIR 583fi 584 585cd $NETBSDSRCDIR && make cleandir 586 587---cut here--- 588 589Critical utilities: 590^^^^^^^^^^^^^^^^^^^ 591 gnu/usr.bin/egcs 592 usr.bin/compile_et 593 usr.bin/make 594 usr.bin/yacc 595 usr.bin/lex 596 usr.bin/xlint 597 usr.sbin/config 598 599Other problems and possible solutions: 600^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 601Symptom:Unreasonable compiler errors. 602Fix: Rebuild gnu/usr.bin/egcs 603 604Symptom:Complaints involving a Makefile. 605Fix: Rebuild usr.bin/make: 606 cd usr.bin/make && make && make install 607 Or, a failsafe method if that doesn't work: 608 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 609 610Fix: Make sure .mk files are up to date. 611 cd share/mk && make install 612 613Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 614Fix: Rebuild usr.sbin/config 615 616Symptom: 617Fix: Rebuild usr.bin/yacc 618 619Symptom: 620Fix: Rebuild usr.bin/lex 621 622Symptom: 623Fix: rm /usr/lib/libbfd.a 624 625Symptom:Obsolete intermediate files are used during compilation 626Fix: Try the following sequence of commands in the directory in question. 627 make cleandir; rm `make print-objdir`; make cleandir; make obj 628 (If you built the tree without "make obj" in the past, obsolete files 629 may remain. The command tries to clean everything up) 630 631Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 632Fix: Rebuild and install usr.bin/menuc 633 634Symptom:mklocale not found during build in share/locale/ctype 635Fix: Build and install usr.bin/mklocale 636 637Symptom:undefined reference to `__assert13' or `__unsetenv13' 638Fix: Rebuild and install lib/libc 639 640Symptom:usr.sbin/config fails to build. 641Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 642 643Symptom:undefined reference to `getprogname' or `setprogname' 644Fix: Rebuild and install lib/libc 645 646Symptom:lint does not understand the '-X' option 647Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 648