UPDATING revision 1.76
1$NetBSD: UPDATING,v 1.76 2002/11/22 15:48:33 thorpej 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 1120021121: 12 The C run-time support files crtbegin.o and crtend.o 13 (and their companions crtbeginS.o and crtendS.o) were 14 split up, with new crti.o and crtn.o files resulting. 15 This means that libtool needs to be rebuilt once the 16 new libraries are installed. The process of rebuilding 17 libtool will cause it to automatically notice the new 18 required files, but it *must* be rebuilt in order to 19 do this. 20 21 An out-of-date libtool will result in shared libraries 22 which lack _init() and _fini() routines, which means that 23 their global contructors/destructors will not be invoked. 24 2520021121: 26 A bug related to how ARM ELF objects were tagged has been 27 corrected. 28 29 NetBSD ARM ELF uses the soft-VFP floating point model by 30 default. However, the assembler lacked support for marking 31 objects as using the VFP floating point format, and the 32 compiler was no properly passing the flag indicating "soft-VFP" 33 to the assembler. 34 35 Unfortunately, this means that the linker will now consider 36 old (i.e. not marked "softvfp") NetBSD ARM ELF objects to be 37 incompatible with new (properly marked) objects. 38 39 The problem will only manifest itself if you attempt to compile 40 a new program using the fixed toolchain, and link that program 41 against old libraries which do not have the proper "softvfp" 42 markings. ALL OF YOUR EXISTING BINARIES AND SHARED LIBRARIES 43 WILL CONTINUE TO WORK PROPERLY. 44 45 The only work-around for the problem is to recompile all of 46 the libraries on the system. The easiest way to do this for 47 system libraries is to install a binary snapshot; there are 48 generally available on releng.netbsd.org. Any packages you 49 have installed which supply libraries will have to be recompiled 50 if you wish to link new programs against those libraries. 51 52 If you have questions about this matter, please contact 53 port-arm@netbsd.org. 54 5520021011: 56 Systrace has been improved to support privilege elevation. 57 Updating the kernel requires the userland part of systrace 58 to be rebuild. 59 6020021010: 61 The config(8) grammar was changed to allow options to register 62 dependencies on attributes, as well as other options. Users 63 must update and reinstall usr.sbin/config before building a new 64 kernel. 65 6620021009: 67 A new attribute dependency syntax was introduced to config(8), 68 which is now used by the SCSI configuration description. Users 69 must update and reinstall usr.sbin/config before building a new 70 kernel. 71 7220021003: 73 Several changes have been made to the autoconfiguration 74 framework. Users must update and reinstall usr.sbin/config 75 before building a new kernel. 76 7720021001: 78 The i386mp branch has been merged. To compile a kernel, users 79 will need to add the option 'cpu* at mainbus?' to their configuration 80 file. Multiprocessor kernels will need 81 ioapic* at mainbus? apid ? 82 options MULTIPROCESSOR 83 options COM_MPLOCK 84 8520020922: 86 MKDYNAMICROOT=yes enabled by default, which means that 87 certain shared libraries are installed into /lib, the shared 88 linker is installed into /libexec, and all programs in /bin 89 and /sbin are dynamically linked. 90 If you do not use "make build", you should ensure that 91 you have the libraries and shared linker in the new locations, 92 with: 93 make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so 94 9520020917: 96 USE_NEW_TOOLCHAIN has been replaced with: 97 - TOOLCHAIN_MISSING -- set to "yes" on platforms for which 98 there is no working in-tree toolchain (hppa, ns32k, sh5, 99 x86_64). 100 - EXTERNAL_TOOLCHAIN -- if defined by the user, points to the 101 root ofan external toolchain (e.g. /usr/local/gnu). This 102 enables the cross-build framework even for TOOLCHAIN_MISSING 103 platforms. 104 10520020906: 106 gehenna-devsw has been merged into the trunk. Need to update and 107 reinstall usr.sbin/config before build the kernel. 108 10920020822: 110 Crunched rescue tools (contents of /bin and /sbin, plus others) 111 are now provided in /rescue. 112 113 To ensure that these are built statically linked (no matter 114 what the setting of LDSTATIC is), use a crunchgen(1) built 115 from sources newer than 20020820 (see the next entry). 116 11720020820: 118 crunchgen(1) changed to ensure that the generated program 119 is statically linked. 120 121 Solution: update and reinstall usr.bin/crunch 122 12320020515: 124 sshd user/group has been added. Need to hand add this in, or sshd 125 will not let you log in (with default, or UsePrivlegeSeparation=yes) 126 127 Add the following into /etc/group: 128 129 sshd:*:16: 130 131 and the following to /etc/master.passwd (via vipw): 132 133 sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin 134 135 also /var/chroot/sshd directory needs to be present (digged as a part of 136 build process). 137 13820020426: 139 NBUILDJOBS obsoleted in favor of just using -j. 140 14120020426: 142 etc/postinstall added, which performs various checks for 143 configuration file updates and changes, and can fix most of 144 the problems identified. 145 This should make it much easier to upgrade a system's 146 configuration from earlier systems (as far back as NetBSD 1.5). 147 14820020320: 149 <bsd.lib.mk> needs a new install(1) for it's "-a cmd" support. 150 build and install at usr.bin/xinstall before the build. 151 15220020319: 153 raw IPv6 socket now makes strict checking for sa_family and sa_len 154 on send(2) operation. be sure to have sbin/rtsol and usr.sbin/rtsold 155 newer than November 2001 when you upgrade the kernel. 156 15720020311: 158 ssh configuration files were moved from /etc to /etc/ssh. Beware 159 if you restart your machine from remote. Note that sshd.conf needs 160 to be changed (due to the use of "/etc" inside). 161 16220020223: 163 Users of the VAX port will need to rebuild and install gas 164 so it deal with the now present register prefix used in all 165 the VAX assembly files. 166 16720020118: 168 169 ntpd user/group has been added. Need to hand add this in or builds 170 will break as mtree aborts early. 171 172 Add the following into /etc/group: 173 174 ntpd:*:15: 175 176 and the following to /etc/master.passwd (via vipw): 177 178 ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin 179 18020011207: 181 182 If you're attempting to build a snapshot on sparc64 and are getting 183 reloc errors from the toolchain groff binary this means your native 184 toolchain has some broken C++ bits. 185 186 To fix: 187 188 Build a new toolchain (i.e. build.sh -t) 189 Use the new toolchain to build and install natively (i.e. /usr/lib) 190 191 gnu/lib/libgcc 192 gnu/lib/libstdc++ 193 194 After this a snapshot will be able to be built. 195 19620011201: 197 In order for a sparc64 build to work you must have a working awk. If 198 you've built and installed a system with the new toolchain up to this 199 point you do not have a working awk as its ability to do floating 200 point is broken. 201 202 To build: 203 204 remake and install gnu/lib/libgcc 205 remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links 206 against the new libgcc.a) 207 20820011128: 209 Kernel config information was changed to use defflag in 210 the various "files" files. Bug fixes to config(8) are 211 required in order for this to work properly. Make sure 212 to build and install in usr.sbin/config before attempting 213 to build a new kernel. 214 21520011030: 216 libc/locale/wcstod.c now needs new lint(1). Update lint(1) 217 before building libc. 218 21920011029: 220 The new document BUILDING.mdoc (view with nroff | more, or 221 see pre-generated .txt and .html versions) describes the build 222 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN 223 build process, are intended in the long run to replace this 224 manual update log. 225 226 Users building a USE_NEW_TOOLCHAIN system should read the 227 BUILDING document for caveats. Generally, BUILDING supersedes 228 UPDATING for these systems, as tool updating is taken care of 229 by the new build system. 230 23120011028: 232 src/etc/Makefile now needs install to be able to handle 233 symlinks that point to nowhere. A bug in install that 234 prevented this was corrected. 235 236 Solution: update and reinstall usr.bin/xinstall 237 Better Solution: Use the new toolchain and it will just work 238 for you. 239 24020011006: 241 /etc/mtree/NetBSD.dist has been updated to take advantage of 242 absolute path support added to mtree(8). Older mtree(8)s don't 243 understand the format. 244 245 Solution: update and reinstall usr.sbin/mtree 246 24720011004: 248 Crunchgen has been updated to work via reach-over makefiles. Updating 249 is suggested before running a snapshot build 250 25120010915: 252 The new "ubcperf" code committed by Chuck Silvers removed 253 a header file, uvm/uvm_vnode.h. There may be stale .depend 254 files that still reference this file. 255 256 Solution: "make cleandir && make dependall" in affected 257 directories. 258 25920010803: 260 grep.info is now built from grep.texi using makeinfo. Since it 261 requires makeinfo v4.0, you need to install new texinfo before 262 building gnu/usr.bin/grep. To install new texinfo, please follow 263 the instruction described in 20010726 entry. 264 26520010803: 266 (i386 only): i386 kernel now uses new instructions like 267 `fxsave' which old gas doesn't understand. To build the 268 kernel successfully, you need to build and install a new toolchain, 269 (i.e., build.sh -t) or (temporarily) comment out "options I686_CPU" 270 from your kernel configuration until you rebuild your userland. 271 See 20011029 above and BUILDING file in this directory for more information. 272 [updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled] 273 27420010731: 275 Bootloader update on ELF platforms. DDB in kernels from before 276 this will be unable to read symbol tables provided by newer 277 bootloaders. 278 27920010726: 280 Texinfo was updated to 4.0. To avoid failures when trying to 281 build the included texinfo files, do: 282 283 cd src/gnu/usr.bin/texinfo 284 make MKINFO=no dependall install 285 28620010718: 287 Enabled correct .init/.fini processing in crt0. The way this 288 was done was to change a -I directive to cc(1), which means 289 make(1) will have a stale dependency (it will be checking the 290 timestamp on the wrong "dot_init.h"). 291 292 The symptom you will see is that new programs die with SIGSEGV 293 if you have a stale dependency. 294 295 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 296 before starting your build. 297 29820010628: 299 A construct was added to uvm_page.h that uncovered a bug 300 in lint(1). If you get a warning/error about a non-portable 301 bitfield, update your lint(1) before proceeding. 302 30320010226: 304 Added named user/group to system. Need to hand add this in or builds 305 will break as mtree aborts early. 306 307 To work around add by hand: 308 309 named:*:14: 310 311 to /etc/group and add: 312 313 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin 314 315 to master.passwd (use vipw for instance if doing by hand). 316 317 Now a make build should progress. 318 31920010219: 320 get/setprogname() added. Any hostprogs that may use this will need 321 to be bootstrapped manually until the host system is current. 322 323 Known problems: sys/arch/macppc/stand/fixcoff 324 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 325 CFLAGS and rebuilding should work) 326 usr.sbin/mdsetimage - Build a static copy if 327 building a snapshot before fully bootstrapped. 328 32920010204: 330 prepare the code to compile with stricter gcc flags. in 331 particular start eliminating redundant declarations. Yacc 332 needs to be installed before make build. 333 33420010114: 335 introduce .if commands(target) in make(1). You need to 336 bring everything up-to-date first, then without installing 337 anything make and install in usr.bin/make, then proceed 338 with make build. 339 34020010101: 341 bsd.subdir.mk committed 20001230 had a bug which caused 342 afterinstall targets to run too soon; update again. 343 34420001230: 345 New share/mk files needed to support .WAIT in SUBDIR variables. 346 If you get make errors, 347 (cd share/mk; make install) 348 Also, PRINTOBJDIR has changed and is now used more heavily. 349 35020001019: 351 The `ca' device driver has been replaced by `ld'; although the 352 major and minor numbers haven't changed, you should update your /dev 353 directory. 354 35520000929: 356 The following make directives are obsoleted. 357 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 358 By default, RSA is built into libcrypto. IDEA and RC5 will not be 359 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 360 additional library libcrypto_{idea,rc5}. 361 362 363Hints for a more successful build: 364^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 365 Build a new kernel first: 366 This makes sure that any new system calls or features 367 expected by the new userland will be present. This 368 helps to avoid critical errors when upgrading. 369 Use object directories: 370 This helps to keep stale object 371 files from polluting the build if a Makefile "forgets" 372 about one. It also makes it easier to clean up after 373 a build. It's also necessary if you want to use the 374 same source tree for multiple machines. 375 To use object directories: 376 a) cd /usr/src ; make cleandir 377 b) Add "OBJMACHINE=yes" to /etc/mk.conf 378 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 379 d) cd /usr/src ; make build 380 Note that running "make obj" in a directory will create 381 in obj.$MACHINE directory. 382 Build to a DESTDIR: 383 This helps to keep old 384 installed files (especially libraries) from interfering 385 with the new build. 386 To build to a DESTDIR, set the DESTDIR environment 387 variable before running make build. It should be set to 388 the pathname of an initially empty directory. 389 Problems: you might need to update critical utilities 390 without using DESTDIR since nothing is executed 391 from what is installed in DESTDIR. 392 (See critical utils, below) 393 Build often: 394 This keeps critical utilities current enough to not choke 395 on any other part of the source tree that depends on up to 396 date functionality. 397 398What to do if things don't work: 399^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 400When things don't work there is usually a few things that commonly 401should be done. 402 1) make includes 403 This should be done automatically by make build. 404 2) cd share/mk && make install 405 Again, automatically done by make build. 406 407Failsafe rebuild of a small part of the tree: 408^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 409To make sure you rebuild something correctly you want to do 410something like the following: 411 1) Make sure the includes and .mk files are up to date. 412 2) Make sure any program used to build the particular 413 utility is up to date. (yacc, lex, etc...) 414 3) cd ...path/to/util... 415 make cleandir 416 rm ...all obj directories... 417 make cleandir # yes, again 418 make obj 419 make depend && make 420 421Failsafe rebuild of the entire tree: 422^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 423If you really want to make sure the source tree is clean and 424ready for a build try the following. Note that sourcing /etc/mk.conf 425(a make(1) Makefile) in this manner is not right, and will not work 426for anyone who uses any make(1) features in /etc/mk.conf. 427 428---cut here--- 429#!/bin/sh 430. /etc/mk.conf 431 432if [ -z $NETBSDSRCDIR ] ; then 433 NETBSDSRCDIR=/usr/src 434fi 435if [ \! -d $NETBSDSRCDIR ] ; then 436 echo Unable to find sources 437 exit 1 438fi 439find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 440 441if [ -z $BSDOBJDIR ] ; then 442 BSDOBJDIR=/usr/obj 443fi 444if [ -d $BSDOBJDIR ] ; then 445 rm -rf $BSDOBJDIR 446fi 447 448cd $NETBSDSRCDIR && make cleandir 449 450---cut here--- 451 452Critical utilities: 453^^^^^^^^^^^^^^^^^^^ 454 gnu/usr.bin/egcs 455 usr.bin/compile_et 456 usr.bin/make 457 usr.bin/yacc 458 usr.bin/lex 459 usr.bin/xlint 460 usr.sbin/config 461 462Other problems and possible solutions: 463^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 464Symptom:Unreasonable compiler errors. 465Fix: Rebuild gnu/usr.bin/egcs 466 467Symptom:Complaints involving a Makefile. 468Fix: Rebuild usr.bin/make: 469 cd usr.bin/make && make && make install 470 Or, a failsafe method if that doesn't work: 471 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 472 473Fix: Make sure .mk files are up to date. 474 cd share/mk && make install 475 476Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 477Fix: Rebuild usr.sbin/config 478 479Symptom: 480Fix: Rebuild usr.bin/yacc 481 482Symptom: 483Fix: Rebuild usr.bin/lex 484 485Symptom: 486Fix: rm /usr/lib/libbfd.a 487 488Symptom:Obsolete intermediate files are used during compilation 489Fix: Try the following sequence of commands in the directory in question. 490 make cleandir; rm `make print-objdir`; make cleandir; make obj 491 (If you built the tree without "make obj" in the past, obsolete files 492 may remain. The command tries to clean everything up) 493 494Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 495Fix: Rebuild and install usr.bin/menuc 496 497Symptom:mklocale not found during build in share/locale/ctype 498Fix: Build and install usr.bin/mklocale 499 500Symptom:undefined reference to `__assert13' 501Fix: Rebuild and install lib/libc 502 503Symptom:usr.sbin/config fails to build. 504Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 505 506Symptom:undefined reference to `getprogname' or `setprogname' 507Fix: Rebuild and install lib/libc 508 509Symptom:lint does not understand the '-X' option 510Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 511