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