UPDATING revision 1.64
1$NetBSD: UPDATING,v 1.64 2002/07/01 02:12:11 sommerfeld 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 1120020515: 12 sshd user/group has been added. Need to hand add this in, or sshd 13 will not let you log in (with default, or UsePrivlegeSeparation=yes) 14 15 Add the following into /etc/group: 16 17 sshd:*:16: 18 19 and the following to /etc/master.passwd (via vipw): 20 21 sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin 22 23 also /var/chroot/sshd directory needs to be present (digged as a part of 24 build process). 25 2620020426: 27 NBUILDJOBS obsoleted in favor of just using -j. 28 2920020426: 30 etc/postinstall added, which performs various checks for 31 configuration file updates and changes, and can fix most of 32 the problems identified. 33 This should make it much easier to upgrade a system's 34 configuration from earlier systems (as far back as NetBSD 1.5). 35 3620020320: 37 <bsd.lib.mk> needs a new install(1) for it's "-a cmd" support. 38 build and install at usr.bin/xinstall before the build. 39 4020020319: 41 raw IPv6 socket now makes strict checking for sa_family and sa_len 42 on send(2) operation. be sure to have sbin/rtsol and usr.sbin/rtsold 43 newer than November 2001 when you upgrade the kernel. 44 4520020311: 46 ssh configuration files were moved from /etc to /etc/ssh. Beware 47 if you restart your machine from remote. Note that sshd.conf needs 48 to be changed (due to the use of "/etc" inside). 49 5020020223: 51 Users of the VAX port will need to rebuild and install gas 52 so it deal with the now present register prefix used in all 53 the VAX assembly files. 54 5520020118: 56 57 ntpd user/group has been added. Need to hand add this in or builds 58 will break as mtree aborts early. 59 60 Add the following into /etc/group: 61 62 ntpd:*:15: 63 64 and the following to /etc/master.passwd (via vipw): 65 66 ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin 67 6820011207: 69 70 If you're attempting to build a snapshot on sparc64 and are getting 71 reloc errors from the toolchain groff binary this means your native 72 toolchain has some broken C++ bits. 73 74 To fix: 75 76 Build a new toolchain (i.e. build.sh -t) 77 Use the new toolchain to build and install natively (i.e. /usr/lib) 78 79 gnu/lib/libgcc 80 gnu/lib/libstdc++ 81 82 After this a snapshot will be able to be built. 83 8420011201: 85 In order for a sparc64 build to work you must have a working awk. If 86 you've built and installed a system with the new toolchain up to this 87 point you do not have a working awk as its ability to do floating 88 point is broken. 89 90 To build: 91 92 remake and install gnu/lib/libgcc 93 remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links 94 against the new libgcc.a) 95 9620011128: 97 Kernel config information was changed to use defflag in 98 the various "files" files. Bug fixes to config(8) are 99 required in order for this to work properly. Make sure 100 to build and install in usr.sbin/config before attempting 101 to build a new kernel. 102 10320011030: 104 libc/locale/wcstod.c now needs new lint(1). Update lint(1) 105 before building libc. 106 10720011029: 108 The new document BUILDING.mdoc (view with nroff | more, or 109 see pre-generated .txt and .html versions) describes the build 110 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN 111 build process, are intended in the long run to replace this 112 manual update log. 113 114 Users building a USE_NEW_TOOLCHAIN system should read the 115 BUILDING document for caveats. Generally, BUILDING supersedes 116 UPDATING for these systems, as tool updating is taken care of 117 by the new build system. 118 11920011028: 120 src/etc/Makefile now needs install to be able to handle 121 symlinks that point to nowhere. A bug in install that 122 prevented this was corrected. 123 124 Solution: update and reinstall usr.bin/xinstall 125 Better Solution: Use the new toolchain and it will just work 126 for you. 127 12820011006: 129 /etc/mtree/NetBSD.dist has been updated to take advantage of 130 absolute path support added to mtree(8). Older mtree(8)s don't 131 understand the format. 132 133 Solution: update and reinstall usr.sbin/mtree 134 13520011004: 136 Crunchgen has been updated to work via reach-over makefiles. Updating 137 is suggested before running a snapshot build 138 13920010915: 140 The new "ubcperf" code committed by Chuck Silvers removed 141 a header file, uvm/uvm_vnode.h. There may be stale .depend 142 files that still reference this file. 143 144 Solution: "make cleandir && make dependall" in affected 145 directories. 146 14720010803: 148 grep.info is now built from grep.texi using makeinfo. Since it 149 requires makeinfo v4.0, you need to install new texinfo before 150 building gnu/usr.bin/grep. To install new texinfo, please follow 151 the instruction described in 20010726 entry. 152 15320010803: 154 (i386 only): i386 kernel now uses new instructions like 155 `fxsave' which old gas doesn't understand. To build the 156 kernel successfully, you need to build and install a new toolchain, 157 (i.e., build.sh -t) or (temporarily) comment out "options I686_CPU" 158 from your kernel configuration until you rebuild your userland. 159 See 20011029 above and BUILDING file in this directory for more information. 160 [updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled] 161 16220010731: 163 Bootloader update on ELF platforms. DDB in kernels from before 164 this will be unable to read symbol tables provided by newer 165 bootloaders. 166 16720010726: 168 Texinfo was updated to 4.0. To avoid failures when trying to 169 build the included texinfo files, do: 170 171 cd src/gnu/usr.bin/texinfo 172 make MKINFO=no dependall install 173 17420010718: 175 Enabled correct .init/.fini processing in crt0. The way this 176 was done was to change a -I directive to cc(1), which means 177 make(1) will have a stale dependency (it will be checking the 178 timestamp on the wrong "dot_init.h"). 179 180 The symptom you will see is that new programs die with SIGSEGV 181 if you have a stale dependency. 182 183 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so 184 before starting your build. 185 18620010628: 187 A construct was added to uvm_page.h that uncovered a bug 188 in lint(1). If you get a warning/error about a non-portable 189 bitfield, update your lint(1) before proceeding. 190 19120010226: 192 Added named user/group to system. Need to hand add this in or builds 193 will break as mtree aborts early. 194 195 To work around add by hand: 196 197 named:*:14: 198 199 to /etc/group and add: 200 201 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin 202 203 to master.passwd (use vipw for instance if doing by hand). 204 205 Now a make build should progress. 206 20720010219: 208 get/setprogname() added. Any hostprogs that may use this will need 209 to be bootstrapped manually until the host system is current. 210 211 Known problems: sys/arch/macppc/stand/fixcoff 212 usr.sbin/config (adding -DMAKE_BOOTSTRAP to 213 CFLAGS and rebuilding should work) 214 usr.sbin/mdsetimage - Build a static copy if 215 building a snapshot before fully bootstrapped. 216 21720010204: 218 prepare the code to compile with stricter gcc flags. in 219 particular start eliminating redundant declarations. Yacc 220 needs to be installed before make build. 221 22220010114: 223 introduce .if commands(target) in make(1). You need to 224 bring everything up-to-date first, then without installing 225 anything make and install in usr.bin/make, then proceed 226 with make build. 227 22820010101: 229 bsd.subdir.mk committed 20001230 had a bug which caused 230 afterinstall targets to run too soon; update again. 231 23220001230: 233 New share/mk files needed to support .WAIT in SUBDIR variables. 234 If you get make errors, 235 (cd share/mk; make install) 236 Also, PRINTOBJDIR has changed and is now used more heavily. 237 23820001019: 239 The `ca' device driver has been replaced by `ld'; although the 240 major and minor numbers haven't changed, you should update your /dev 241 directory. 242 24320000929: 244 The following make directives are obsoleted. 245 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 246 By default, RSA is built into libcrypto. IDEA and RC5 will not be 247 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build 248 additional library libcrypto_{idea,rc5}. 249 250 251Hints for a more successful build: 252^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 253 Build a new kernel first: 254 This makes sure that any new system calls or features 255 expected by the new userland will be present. This 256 helps to avoid critical errors when upgrading. 257 Use object directories: 258 This helps to keep stale object 259 files from polluting the build if a Makefile "forgets" 260 about one. It also makes it easier to clean up after 261 a build. It's also necessary if you want to use the 262 same source tree for multiple machines. 263 To use object directories: 264 a) cd /usr/src ; make cleandir 265 b) Add "OBJMACHINE=yes" to /etc/mk.conf 266 c) Add "MKOBJDIRS=yes" to /etc/mk.conf 267 d) cd /usr/src ; make build 268 Note that running "make obj" in a directory will create 269 in obj.$MACHINE directory. 270 Build to a DESTDIR: 271 This helps to keep old 272 installed files (especially libraries) from interfering 273 with the new build. 274 To build to a DESTDIR, set the DESTDIR environment 275 variable before running make build. It should be set to 276 the pathname of an initially empty directory. 277 Problems: you might need to update critical utilities 278 without using DESTDIR since nothing is executed 279 from what is installed in DESTDIR. 280 (See critical utils, below) 281 Build often: 282 This keeps critical utilities current enough to not choke 283 on any other part of the source tree that depends on up to 284 date functionality. 285 286What to do if things don't work: 287^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 288When things don't work there is usually a few things that commonly 289should be done. 290 1) make includes 291 This should be done automatically by make build. 292 2) cd share/mk && make install 293 Again, automatically done by make build. 294 295Failsafe rebuild of a small part of the tree: 296^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 297To make sure you rebuild something correctly you want to do 298something like the following: 299 1) Make sure the includes and .mk files are up to date. 300 2) Make sure any program used to build the particular 301 utility is up to date. (yacc, lex, etc...) 302 3) cd ...path/to/util... 303 make cleandir 304 rm ...all obj directories... 305 make cleandir # yes, again 306 make obj 307 make depend && make 308 309Failsafe rebuild of the entire tree: 310^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 311If you really want to make sure the source tree is clean and 312ready for a build try the following. Note that sourcing /etc/mk.conf 313(a make(1) Makefile) in this manner is not right, and will not work 314for anyone who uses any make(1) features in /etc/mk.conf. 315 316---cut here--- 317#!/bin/sh 318. /etc/mk.conf 319 320if [ -z $NETBSDSRCDIR ] ; then 321 NETBSDSRCDIR=/usr/src 322fi 323if [ \! -d $NETBSDSRCDIR ] ; then 324 echo Unable to find sources 325 exit 1 326fi 327find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 328 329if [ -z $BSDOBJDIR ] ; then 330 BSDOBJDIR=/usr/obj 331fi 332if [ -d $BSDOBJDIR ] ; then 333 rm -rf $BSDOBJDIR 334fi 335 336cd $NETBSDSRCDIR && make cleandir 337 338---cut here--- 339 340Critical utilities: 341^^^^^^^^^^^^^^^^^^^ 342 gnu/usr.bin/egcs 343 usr.bin/compile_et 344 usr.bin/make 345 usr.bin/yacc 346 usr.bin/lex 347 usr.bin/xlint 348 usr.sbin/config 349 350Other problems and possible solutions: 351^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 352Symptom:Unreasonable compiler errors. 353Fix: Rebuild gnu/usr.bin/egcs 354 355Symptom:Complaints involving a Makefile. 356Fix: Rebuild usr.bin/make: 357 cd usr.bin/make && make && make install 358 Or, a failsafe method if that doesn't work: 359 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin 360 361Fix: Make sure .mk files are up to date. 362 cd share/mk && make install 363 364Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 365Fix: Rebuild usr.sbin/config 366 367Symptom: 368Fix: Rebuild usr.bin/yacc 369 370Symptom: 371Fix: Rebuild usr.bin/lex 372 373Symptom: 374Fix: rm /usr/lib/libbfd.a 375 376Symptom:Obsolete intermediate files are used during compilation 377Fix: Try the following sequence of commands in the directory in question. 378 make cleandir; rm `make print-objdir`; make cleandir; make obj 379 (If you built the tree without "make obj" in the past, obsolete files 380 may remain. The command tries to clean everything up) 381 382Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 383Fix: Rebuild and install usr.bin/menuc 384 385Symptom:mklocale not found during build in share/locale/ctype 386Fix: Build and install usr.bin/mklocale 387 388Symptom:undefined reference to `__assert13' 389Fix: Rebuild and install lib/libc 390 391Symptom:usr.sbin/config fails to build. 392Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 393 394Symptom:undefined reference to `getprogname' or `setprogname' 395Fix: Rebuild and install lib/libc 396 397Symptom:lint does not understand the '-X' option 398Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 399