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