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