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