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