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